Install Yii2 under CentOS

It is assumed that linux, mysql, php, nginx/apache have been installed here

1. Install curl extension (you can skip it if you have installed it)< /strong>

yum -y install curl
2. curl -sS https: //getcomposer.org/installer| php
If prompted bash: php: command not found
Solution
export PATH= $PATH:/usr/local/php/bin
Then, echo $PATH again to see it.
usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/php/bin
At this time , You can directly type php -i in any directory of the system to execute it.
Continue execution:
mv composer.phar < /span> /usr/local/bin/composer span>
3. Configure Composer China update mirror
composer config -l -g

share picture

   Mine is /root/.config/composer

 // Edit the configuration file
vim /root/.config/composerconfig.json
 // Edit composer running configuration file config.json
{
    "config": {  }, "repositories": [{"packagist": false }, {"type": "composer", " url": "https://packagist.phpcomposer.com/"}] }


//update composer// edit project Dependency description file composer.json composer config -e
composerself-update
< /pre>

Install yii2-Advanced

After Composer is installed, switch to a web-accessible directory and execute the following command to install Yii:

composer global require " fxp/composer-asset-plugin:~1.1.1"
composer create-project yiisoft/yii2-app-advanced advanced 2.0.11

After installing the template, you need To initialize the template, cd into the yii2 project directory, enter the php init command, and then select the development environment 0, y, all to initialize< /spa n>

yum -y install curl
2. curl -sS https: / /getcomposer.org/installer| php
If it prompts bash: php: command not found
Solution< /div>
export PATH=$PATH:/usr/local/php/bin
Then, echo $PATH again to see it.
usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/php/bin
At this time , You can directly type php -i in any directory of the system to execute it.
Continue execution:
mv composer.phar < /span> /usr/local/bin/composer span>
3. Configure Composer China update mirror
composer config -l -g

share picture

   Mine is /root/.config/composer

 // Edit the configuration file
vim /root/.config/composerconfig.json
// Edit composer running configuration file config .json
{
    "config": {  }, "repositories": [{"packagist": false }, {"type": "composer", " url": "https://packagist.phpcomposer.com/"}] }


//update composer// edit project Dependency description file composer.json composer config -e
composerself-update
< /pre>

Install yii2-Advanced

After Composer is installed, switch to a web-accessible directory and execute the following command to install Yii:

composer global require " fxp/composer-asset-plugin:~1.1.1"
composer create-project yiisoft/yii2-app-advanced advanced 2.0.11

After installing the template, you need To initialize the template, cd into the yii2 project directory, enter the php init command, and then select the development environment 0, y, all to initialize< /span>

yum -y install curl

2. curl -sS https: //getcomposer.org/installer| php

If it prompts bash: php: command not found

Solution

export PATH=$PATH:/usr/local/php/bin
Then, echo $PATH again to see it.
usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/php/bin
At this time , You can directly type php -i in any directory of the system to execute it.

Continue execution:

mv composer.phar /usr/local/bin/composer

3.Configure Composer China update mirror

composer config -l- g

share picture

   mine is /root/.config/composer

  // Edit configuration file
vim /root/.config/composerconfig.json
// Edit composer running configuration file config.json
{
    "config": {  }, "repositories": [{"packagist": false }, {"type": "composer", " url": "https://packagist.phpcomposer.com/"}] }


//update composer// edit project Dependency description file composer.json composer config -e
composerself-update
< /pre>

Install yii2-Advanced

After Composer is installed, switch to a web-accessible directory and execute the following command to install Yii:

composer global require " fxp/composer-asset-plugin:~1.1.1"
composer create-project yiisoft/yii2-app-advanced advanced 2.0.11

After installing the template, you need To initialize the template, cd into the yii2 project directory, enter the php init command, and then select the development environment 0, y, all to initialize< /span>

Leave a Comment

Your email address will not be published.