笔者趁着双十一买了阿里的服务器,装上centos7和php7,准备玩一玩swoole,不说了,下面贴一下 装lnmp1.6时常见的错误及处理方案。(都是亲测有效的。)
1、错误1:nginx下tp5和laravel5的伪静态:(亲测可用,可直接使用ip:port访问,域名还没审批下来 -- 阿里云安全组记得打开,firewall关闭)
server { listen 8055; server_name localhost; root /home/wwwroot/default/laravel5.5/public/; #index index.php index.html index.htm; location / { index index.html index.htm index.php; autoindex off; if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } } location ~ \.php(.*)$ { fastcgi_pass unix:/tmp/php-cgi.sock; #这个和php-fpm.conf的listen必须一致,否则nginx无法与php-fpm通信 fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /home/wwwlogs/laravel5.5-access.log; }
2、问题2及解决方案:nginx伪静态配好了,php7访问还是报错:Access Denied!
访问nginx-php页面的时候 报access denied. 访问页面的时候出现这个时access denied 只需到/usr/local/php/etc/php.ini中修改一下 ① 将【 ;open_basedir = 】 注释掉
② 把这个值赋值为1 cgi.fix_pathinfo=1
重启nginx
3、问题3:MySQL5.7报错:
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns
in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
处理方案:
我们先看看原因:
MySQL 5.7.5及以上功能依赖检测功能。如果启用了ONLY_FULL_GROUP_BY SQL模式(默认情况下),MySQL将拒绝选择列表,HAVING条件或ORDER BY列表的查询引用在GROUP BY子句中既未命名的非集合列,也不在功能上依赖于它们。(5.7.5之前,MySQL没有检测到功能依赖关系,默认情况下不启用ONLY_FULL_GROUP_BY。有关5.7.5之前的行为的说明,请参见“MySQL 5.6参考手册”。)
navicat执行:
SHOW VARIABLES LIKE '%sql_mode%' ; 里面有: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
就是前面的【ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,】这两个变量坏的事,去掉这2个
根治办法:
首先stop mysql,
首先stop mysql,
首先stop mysql,
vi /etc/my.cnf 在【mysqld】下查找sql_mode,没有则新增: sql_mode = "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
重启MySQL,ojbk。