yanqzh 发表于 2016-11-4 12:40:45

开启opcache频见500,502错误

使用的是lnmp1.2,php5.4.41,开启的是自带的zend opcache7.0.4. 系统是centos6.5
开启後多个网站出现502甚至500,于是将opcache配置参数移到的上方,并且将zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/opcache.so" 的双引号去掉,改为:zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/opcache.so。

结果是其他网站如discuz、mediawiki、wecenter搭建的网站恢复正常,但discuz后台显示空白,而moodle搭建的网站出现500现象,及Command line scripts must define CLI_SCRIPT before requiring config.php错误提示。
vi /usr/local/php/var/log/php-fpm*log:
NOTICE: ready to handle connections
NOTICE: Finishing ...
NOTICE: exiting, bye-bye!
NOTICE: fpm is running, pid 9185
NOTICE: ready to handle connections
WARNING: child 9196, script '/home/wwrot/www/index.php' (request: "HEAD /index.php") execution timed out (347.266284 sec), terminating
WARNING: child 9194, script '/home/wwrot/www/home.php' (request: "GET /home.php") execution timed out (341.136443 sec), terminating
WARNING: child 9191, script '/home/wwrot/wiki/index.php' (request: "GET /index.php") execution timed out (351.090878 sec), terminating
WARNING: child 9196 exited on signal 15 (SIGTERM) after 900.019190 seconds from start
NOTICE: child 10308 started
WARNING: child 9191 exited on signal 15 (SIGTERM) after 900.023240 seconds from start
NOTICE: child 10309 started
WARNING: child 9194 exited on signal 15 (SIGTERM) after 900.022998 seconds from start
NOTICE: child 10310 started
NOTICE: Finishing ...
NOTICE: exiting, bye-bye!
NOTICE: fpm is running, pid 10921
NOTICE: ready to handle connections


vi /var/log/slow.log提示文件为空白,php-fpm.conf已经开启该错误记录

vi /home/wwwlogs/nginx_error.log:
2016/11/04 12:06:02 7661#0: *1 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: 117.44.16.115, server: 省略, request: "GET /topic/ HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "省略", referrer: "省略"
2016/11/04 12:06:04 7661#0: *3 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: 54.223.190.116, server: 省略, request: "GET /news/whzc/ HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "省略"
2016/11/04 12:26:56 10512#0: *1 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: 1.58.136.229, server: 省略, request: "GET 省略网址 HTTP/1.0", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "省略", referrer: "省略"
2016/11/04 12:26:57 10512#0: *5 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: 123.125.71.109, server: 省略, request: "GET 省略网址 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "省略"


呼叫军哥,已经修改php-fpm的max_children到128,并调节min_children到20,discuz后台显示恢复正常,但moodle错误依旧

licess 发表于 2016-11-4 13:08:48

只按上面的日志,提示的文件执行超时

看一按指定贴502排查方法启用php慢日志和错误日志看看

yanqzh 发表于 2016-11-4 13:46:17

php慢日志和错误日志已经启用,php的错误日志是放在什么位置的呢
; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
; http://php.net/error-log
; Example:
error_log = php_errors.log
; Log errors to syslog (Event Log on Windows).
;error_log = syslog

yanqzh 发表于 2016-11-4 13:49:11

; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = Off

yanqzh 发表于 2016-11-4 13:49:31

; Development Value: On
; Production Value: On
; http://php.net/log-errors
log_errors = On

yanqzh 发表于 2016-11-4 13:54:53

查看到错误日志了,moodle下日志错误:

PHP Warning:require_once(/home/wwrot/moodle/moodle/cache/lib.php): failed to open stream: No such file or directory in /home/wwrot/moodle/moodle/lib/setup.php on line 606
PHP Fatal error:require_once(): Failed opening required '/home/wwrot/moodle/moodle/cache/lib.php' (include_path='/home/wwrot/moodle/moodle/lib/pear:.:/usr/local/php/lib/php') in /home/wwrot/moodle/moodle/lib/setup.php on line 606
PHP Warning:require_once(/home/wwrot/moodle/moodle/cache/lib.php): failed to open stream: No such file or directory in /home/wwrot/moodle/moodle/lib/setup.php on line 606
PHP Fatal error:require_once(): Failed opening required '/home/wwrot/moodle/moodle/cache/lib.php' (include_path='/home/wwrot/moodle/moodle/lib/pear:.:/usr/local/php/lib/php') in /home/wwrot/moodle/moodle/lib/setup.php on line 606
PHP Warning:require_once(/home/wwrot/moodle/moodle/cache/lib.php): failed to open stream: No such file or directory in /home/wwrot/moodle/moodle/lib/setup.php on line 606
PHP Fatal error:require_once(): Failed opening required '/home/wwrot/moodle/moodle/cache/lib.php' (include_path='/home/wwrot/moodle/moodle/lib/pear:.:/usr/local/php/lib/php') in /home/wwrot/moodle/moodle/lib/setup.php on line 606

PHP Warning:require_once(/home/wwrot/moodle/moodle/cache/lib.php): failed to open stream: No such file or directory in /home/wwrot/moodle/moodle/lib/setup.php on line 606
PHP Fatal error:require_once(): Failed opening required '/home/wwrot/moodle/moodle/cache/lib.php' (include_path='/home/wwrot/moodle/moodle/lib/pear:.:/usr/local/php/lib/php') in /home/wwrot/moodle/moodle/lib/setup.php on line 606
PHP Warning:require_once(/home/wwrot/moodle/moodle/cache/lib.php): failed to open stream: No such file or directory in /home/wwrot/moodle/moodle/lib/setup.php on line 606

[ 本帖最后由 yanqzh 于 2016-11-4 13:55 编辑 ]

yanqzh 发表于 2016-11-4 13:57:37

discuz网站错误如下:

PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14
PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14
PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14
PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14
PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14
PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14
PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14
PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14
PHP Notice:Undefined variable: _SERVER in /home/wwwroot/discuz/archiver/index.php on line 14

yanqzh 发表于 2016-11-4 13:59:24

这是打开探针页时返回的错误:

PHP Fatal error:Uncaught exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: MySQL server has gone away' in /home/wwwroot/ask/system/Zend/Db/Statement/Mysqli.php:77
Stack trace:
#0 /home/wwwroot/ask/system/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('SELECT `aws_ses...')
#1 /home/wwwroot/ask/system/Zend/Db/Adapter/Mysqli.php(388): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'SELECT `aws_ses...')
#2 /home/wwwroot/ask/system/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Adapter_Mysqli->prepare('SELECT `aws_ses...')
#3 /home/wwwroot/ask/system/Zend/Db/Table/Abstract.php(1577): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select))
#4 /home/wwwroot/ask/system/Zend/Db/Table/Abstract.php(1392): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select))
#5 /home/wwwroot/ask/system/Zend/Db/Table/Abstract.php(1357): Zend_Db_Table_Abstract->fetchAll('((`aws_sessions...')
#6 : Zend_Db_Table_Abstract->find('9mslh1ih2daoh0f...')
#7 /home/wwwroot/ask/system/Zend in /home/wwwroot/ask/system/Zend/Db/Statement/Mysqli.php on line 77

yanqzh 发表于 2016-11-6 18:50:07

军哥,麻烦回一下吖,谢谢!

licess 发表于 2016-11-7 09:49:42

6楼 日志里显示你网站目录文件不存在,检测提示的 /home/wwrot/moodle。。。的目录和文件

7楼错误不清楚

8楼 显示数据库没运行

yanqzh 发表于 2016-11-7 10:53:15

原帖由 licess 于 2016-11-7 09:49 发表 http://bbs.vpser.net/images/common/back.gif
6楼 日志里显示你网站目录文件不存在,检测提示的 /home/wwrot/moodle。。。的目录和文件

7楼错误不清楚

8楼 显示数据库没运行

网站目录文件是存在的,8楼的时候,数据库也是运行中的,因为其他网站正常打开
页: [1]
查看完整版本: 开启opcache频见500,502错误