1.安装 Composer

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

报网络连接超时

在浏览器打开安装包地址
http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.2/php7.2-mbstring_7.2.9-1+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 ~
©著作权归作者所有:来自51CTO博客作者独孤一笑的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. Linux环境安装Python3.6.x
  2. CentOS7 安装MySQL 5.7方法总结 - 实操手册
  3. Centos7.4安装kvm虚拟机(使用virt-manager管理)
  4. CentOS 7.1静默安装11.2.0.3 64位单机数据库软件
  5. 如何批量Ping N个IP地址,掌握一个命令让你节省N小时,让老板给你加
  6. CCNA最实用的复习知识点(1)
  7. 如何安装DBMS_NETWORK_ACL_ADMIN包?
  8. Kubernetes踩坑记---单点集群安装
  9. zabbix3.4安装

随机推荐

  1. PHP获取绝对路径dirname(__FILE__)和__DI
  2. nginx php-fpm 输出php错误日志
  3. 深入理解PHP原理之变量作用域(Scope in P
  4. PHP二维数组(或任意维数组)转换成一维数组
  5. php如何计算两个时间戳之间相差的日时分
  6. 深入理解PHP原理之变量(Variables inside
  7. PHP提取多维数组指定一列的方法大全
  8. php访问url的四种方式
  9. php自动生成sitemap
  10. php 数组排序函数