How Linux uses composer to install YII2 and bug handling

Source: Internet
Author: User
Tags autoload yii


Here's how to install Yii2 under Linux , see my other blog post for windows to install YII2 http://blog.csdn.net/zqtsx/article/details/ 39344913

The first step installs the composer:

Syntax: "Curl-ss Https://getcomposer.org/installer | PHP executable file path in the bin directory in PHP "
My php executable file is located on the path/usr/local/php/bin/php
So the actual installation command is as follows:
Curl-ss Https://getcomposer.org/installer | /usr/local/php/bin/php
For later use, move it to the local system executable directory and rename it to composer (so that you do not have to write Composer.phar long name after executing the command, write composer directly)
MV Composer.phar/usr/local/bin/composer

Step two install composer Asset Plugin:

Execute the following command at the command line note that the actual PHP file address and the actual composer address in the syntax are modified to your own installation address:

(Syntax: php/bin/php file path + Composer file installation path + global require "fxp/composer-asset-plugin:1.0.0-beta3" note that spaces and punctuation are not Chinese)
/usr/local/php/bin/php/usr/local/bin/composer global require "FXP/COMPOSER-ASSET-PLUGIN:1.0.0-BETA3"
A message similar to the following indicates that everything is installed properly (pick up Yii2 installed under Sky Star Linux):
"Changed Current directory To/root/.composer
./composer.json has been created
Loading Composer repositories with the package information
Updating dependencies (including Require-dev)
-Installing Fxp/composer-asset-plugin (V1.0.0-BETA3)
downloading:100%

Writing Lock File
Generating autoload Files "

Step three installation YII2

command line to switch to a site directory that PHP can access

Then execute the command (note that the PHP executable path and the composer path are modified to your own installation path):
The following command installs the Yii2.0.0 version in the directory named Yii2, and the directory name can be modified to suit your needs:
/usr/local/php/bin/php/usr/local/bin/composer create-project yiisoft/yii2-app-basic yii2 2.0.0
Need to wait patiently, the installation process may appear the following information asks you to enter the user name and password (oneself to the YII official website "https://github.com/" registers an account, the account password fills in is OK):
Installing Yiisoft/yii2-app-basic (2.0.0)
-Installing Yiisoft/yii2-app-basic (2.0.0)
downloading:100%

Created Project in Yii2
Loading Composer repositories with the package information
Installing dependencies (including Require-dev)
Reading Bower.json of Bower-asset/jquery.inputmask (3.1.29)
Could not fetch https://api.github.com/repos/RobinHerbots/jquery.inputmask/contents/bower.json?ref= FAF19625822FBD54765D26BAAC3154CD132769D1, enter your GitHub credentials to go through the API rate limit
The credentials would be swapped to an OAuth token stored in/root/.composer/auth.json, your password would not be stored
To revoke access to the token you can visit https://github.com/settings/applications
Username:myyiiname (fill in the account name you registered on the website)
Password:myyiipwd (password, you know)
After entering your account password, you will be prompted with the following authentication success (If there is no proof that your account password is wrong, or the new account you just registered on the YII website is not activated by email):
Token successfully created

Certification through the prompt information below followed by a line below the progress of the information, the installation process, you need to wait patiently, the following decimal point will vary with the installation progress,
Reading Bower.json of Bower-asset/typeahead.js (v0.10.0)

Then slowly and orderly appear some of the following progress bar, but also need to wait patiently (pick up the Sky star Linux installed Yii2):

-Installing Yiisoft/yii2-composer (2.0.0)
downloading:100%

-Installing Swiftmailer/swiftmailer (v5.3.0)
downloading:100%

-Installing Bower-asset/jquery (2.1.1)
downloading:100%

-Installing Bower-asset/yii2-pjax (v2.0.1)
downloading:100%

-Installing Bower-asset/punycode (v1.3.2)
downloading:100%

-Installing Bower-asset/jquery.inputmask (3.1.41)
downloading:100%

-Installing Cebe/markdown (1.0.1)
downloading:100%

-Installing Ezyang/htmlpurifier (v4.6.0)
downloading:100%

-Installing YIISOFT/YII2 (2.0.0)
downloading:100%

-Installing Yiisoft/yii2-swiftmailer (2.0.0)
downloading:100%

-Installing yiisoft/yii2-codeception (2.0.0)
downloading:100%

-Installing Bower-asset/bootstrap (v3.2.0)
downloading:65%

until a complete message similar to the following appears, instructions YII2 download installation End
Installing Yiisoft/yii2-app-basic (2.0.0)
-Installing Yiisoft/yii2-app-basic (2.0.0)
Loading from Cache

Created Project in Yii2
Loading Composer repositories with the package information
Installing dependencies (including Require-dev)
-Installing Yiisoft/yii2-composer (2.0.0)
Loading from Cache

-Installing Swiftmailer/swiftmailer (v5.3.0)
Loading from Cache

-Installing Bower-asset/jquery (2.1.1)
Loading from Cache

-Installing Bower-asset/yii2-pjax (v2.0.1)
Loading from Cache

-Installing Bower-asset/punycode (v1.3.2)
Loading from Cache

-Installing Bower-asset/jquery.inputmask (3.1.41)
Loading from Cache

-Installing Cebe/markdown (1.0.1)
Loading from Cache

-Installing Ezyang/htmlpurifier (v4.6.0)
Loading from Cache

-Installing YIISOFT/YII2 (2.0.0)
Loading from Cache

-Installing Yiisoft/yii2-swiftmailer (2.0.0)
Loading from Cache

-Installing yiisoft/yii2-codeception (2.0.0)
Loading from Cache

-Installing Bower-asset/bootstrap (v3.2.0)
downloading:100%

-Installing Yiisoft/yii2-bootstrap (2.0.0)
downloading:100%

-Installing Yiisoft/yii2-debug (2.0.0)
downloading:100%

-Installing Bower-asset/typeahead.js (v0.10.5)
downloading:100%

-Installing Phpspec/php-diff (v1.0.2)
downloading:100%

-Installing yiisoft/yii2-gii (2.0.0)
downloading:100%

-Installing Fzaninotto/faker (v1.4.0)
downloading:100%

-Installing Yiisoft/yii2-faker (2.0.0)
downloading:100%

Writing Lock File
Generating autoload files
chmod (' Runtime ', 0777) ... done.
chmod (' Web/assets ', 0777) ... done.
chmod (' Yii ', 0755) ... done.

Here, the entire YII2 is installed.

Fourth Step Test Yii2 is installed successfully

First modify the Nginx or Apache configuration information to add the Yii2 directory as a virtual site Directory

I here is nginx configuration, directly in the Nginx add a yii2 site Directory is a
In Nginx add similar to the following site settings, we here Yii2 installation directory is/VAR/WWW/YII2 so set the site directory for/VAR/WWW/YII2
Because before 127.0.0.1 and 127.0.0.2 already have two items in, so here set yii2 site local IP is 127.0.0.3
My specific configuration is as follows:

server {
Listen 80;
Listen 127.0.0.3;
server_name somename alias Another.alias;

Location/{
root/var/www/yii2/;
Index index.php index.html index.htm;
}

Location ~ \.php$ {
#root html;
root/var/www/yii2/;
#an Quan Guo Lv
Try_files $uri = 404;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
#fastcgi_param Script_filename/scripts$fastcgi_script_name;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
#include fastcgi_params;
Include fastcgi.conf;
}

Location ~* \. (?: Gif|ico|jpe?g|png|swf|bmp|mp3) $ {

Valid_referers none blocked 127.0.0.3 localhost baidu.com *.baidu.com google.com.hk *.google.com.hk *.google.com;
if ($invalid _referer) {
return 404;
}
#
#expires 30d;
Log_not_found off;
# # need to bleed constant updates. Send the all shebang in one
#
# Fell swoop.
#
Tcp_nodelay off;
#
# Set the OS file cache.
#
Open_file_cache max=1000 inactive=120s;
Open_file_cache_valid 125s;
Open_file_cache_min_uses 2;
Open_file_cache_errors off;
root/var/www/yii2/;
#
}

Location ~* \. (Js|css|mid) $ {
Expires 1d;
root/var/www/yii2/;
}


}

Then enter http://127.0.0.3/web/in the browser to see the home page information of the YII2 site
At this point, the yii2.0.0 version of the installation, testing everything OK, you can start your development journey ...

Fifth Step Yii2 A solution that appears calling unknown Method:yii\web\urlmanager::addrules () error:

If you encounter an error similar to calling unknown Method:yii\web\urlmanager::addrules () when accessing Yii after installation, see another blog post with the Sky Star:

http://blog.csdn.net/zqtsx/article/details/39345015

How Linux uses composer to install YII2 and bug handling

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.