https://www.yiichina.com/doc/guide/2.0/start-installation
通过 Composer 安装
curl
-sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

解决方案
sudo vim
/etc/php/7.2/cli/php.ini
zlib.output_compression = ON

安装成功

2.安装
yii2 高级版
安装yii2
composer create
-project --prefer-dist yiisoft/yii2-app-advanced yii-application
报错:
更换源:
composer config repo
.packagist composer https://packagist.phpcomposer.com
报错:

加参数-g global
composer config
-g repo.packagist composer https://packagist.phpcomposer.com
再次安装yii2
composer create
-project --prefer-dist yiisoft/yii2-app-advanced yii-application

更改网络连接方式,桥接方式
安装php-mbstring
sudo apt
-get install php-mbstring
报网络连接超时

在浏览器打开安装包地址
+ubuntu16.04.1+deb.sury.org+1_amd64.deb
不能访问,
发现另外一个复制的虚拟机也打开了,怀疑是IP地址冲突,关掉另外一台虚拟机后,可以打开这个地址
再次安装,报错:
composer create
-project --prefer-dist yiisoft/yii2-app-advanced yii-application

执行:sudo apt-get install phpunitsudo apt-get install php7.2-xml
再次安装,安装成功
composer create
-project --prefer-dist yiisoft/yii2-app-advanced yii-application


3.配置nginx
sudo vim
/etc/nginx/sites-available/default
server
{
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name frontend.test;
root
/home/jay/yii-application/frontend/web/;
index
index.php;
access_log /home/jay/yii-application/log/frontend-access.log;
error_log /home/jay/yii-application/log/frontend-error.log;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri =404;
}
location ~* /\. {
deny all;
}
}
server {
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name backend.test;
root
/home/jay/yii-application/backend/web/;
index
index.php;
access_log /home/jay/yii-application/log/backend-access.log;
error_log /home/jay/yii-application/log/backend-error.log;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri =404;
}
location ~* /\. {
deny all;