How many ways to install Yii2
Using Composer is one of the best way to install the Yii because composer way allowing developers to install new extensions and upgrade the framework to the latest version.
Another way is to download the archive file.
Lets start with composer approach.
Installing via Composer
Open command prompt (cmd) for windows or terminal for ubuntu and typecomposer --version
D:\Xampp\htdocs\yii2>composer --version
Composer version 1.8.6 2019-06-11 15:03:05
If you found above output then make sure you are using latest version so trigger below command.
D:\Xampp\htdocs\yii2>composer self-update
If you do not found composer installed then firstly install the composer.
For windows user, as always most of the time, use Composer-Setup,exe
For Linux and Mac OS X, you will run following commands.
curl -s http://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Once composer has been installed then now we are good to go with the Yii installation.
D:\Xampp\htdocs\yii2>composer global require "fxp/composer-asset-plugin:1.0.0"
D:\Xampp\htdocs\yii2>composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic .
Please note, i have added .(dot) at the last position which means installing yii into the current directory(D:\Xampp\htdocs\yii2) only.
Note that the development version of Yii should not be used for production as it may break your running code.
Installing Yii from an archive file
Installing Yii from an archive file involves three steps:
1. Download the archive file from yiiframework.com.
2. Unpack the downloaded file to a Web-accessible folder (D:\Xampp\htdocs\)
3. Open the config/web.php file by entering a secret key for the cookieValidationKey configuration item.
'cookieValidationKey' => 'enter your secret key here',
How to verify Installation
http://localhost/yii2/web/index.php
OR
http://127.0.0.1/yii2/web/index.php
Be aware the I have assumed that Yii installed in a directory named basic under D:\Xampp\htdocs\ directory or /var/www/html/ for linux.
You may need to adjust it to your installation environment.
Yii requirements
Open URL http://localhost/yii2/requirements.php
No comments:
Post a Comment
Comment has been successfully posted.