【发布时间】:2017-03-13 08:23:27
【问题描述】:
我在 Sentrifugo 的一些 php 页面上获得 500 状态并找出什么 出错了我尝试设置错误日志记录
配置可以在this gist找到
但是,在我得到 500 的页面上,我在任何这些文件中都看不到任何日志条目
/var/log/php7.0-fpm.log
/var/log/php_errors.log
工作池日志目录为空
anadi@foo:~$ sudo ls -ltr /var/log/php-fpm/
total 0
我看到的只是 access.log 中记录的 500 状态,根本没有任何信息可以帮助我进行故障排除
XX.XXX.XX.XX - - [13/Mar/2017:13:48:53 +0530] "GET /index.php/wizard/configuresite HTTP/2.0" 500 390 "https://foo.bar.com/index.php/wizard/managemenu" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
/var/log/nginx/foo/error.log 中也没有条目
更新
所有日志目录都可以由各自的所有者写入
anadi@foo:~$ ps -ef | grep php
root 19453 1 0 15:24 ? 00:00:00 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
www-data 19458 19453 0 15:24 ? 00:00:00 php-fpm: pool www
www-data 19459 19453 0 15:24 ? 00:00:00 php-fpm: pool www
anadi@foo:~$ ls -ltr /var/log/ | grep php
-rw-r--r-- 1 root root 1679 Mar 13 10:47 php_errors.log
drwxr-xr-x 2 www-data www-data 4096 Mar 13 15:23 php-fpm
-rw------- 1 root root 13590 Mar 13 15:24 php7.0-fpm.log
anadi@foo:~$ ls -ltr /var/log/php-fpm/
total 4
-rw-r--r-- 1 www-data www-data 0 Mar 13 15:23 www.error.log
-rw-r--r-- 1 www-data www-data 2041 Mar 13 15:34 www.access.log
anadi@foo:~$ ps -ef | grep nginx
root 19632 1 0 15:27 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 19633 19632 0 15:27 ? 00:00:00 nginx: worker process
www-data 19634 19632 0 15:27 ? 00:00:00 nginx: worker process
anadi@foo:~$ ls -ltr /var/www/
total 8
drwxrwxr-x 2 www-data www-data 4096 Mar 3 21:18 html
drwxr-xr-x 10 www-data www-data 4096 Mar 13 15:31 foo
anadi@foo:~$ ls -ltr /var/log/nginx/
total 16
drwxr-xr-x 2 www-data www-data 4096 Mar 13 09:58 foo
-rw-r--r-- 1 root root 1105 Mar 13 15:08 error.log
-rw-r--r-- 1 root root 5384 Mar 13 15:41 access.log
按照其中一个答案的说明对display_errors 设置进行了更改,但这仍然没有为故障排除提供任何有用的日志输出。
这是var/log/php-fpm/www.acccess.log的摘录
- - 13/Mar/2017:15:32:11 +0530 "GET /index.php" 500 /var/www/tribe/index.php 34.722 2048 57.60%
- - 13/Mar/2017:15:34:14 +0530 "GET /index.php" 500 /var/www/tribe/index.php 20.952 4096 95.46%
【问题讨论】:
-
你需要检查你的 nginx 错误日志,而不是访问日志,在 ubuntu 中它通常在这个路径下:
/var/log/nginx/error.log -
@hassan 我也见过,没有与此请求相关的错误消息
-
500错误表示你的脚本中经常有语法错误在服务器中执行,把这个动作的代码
configuresite检查出来 -
我明白这一点,但是在给定配置的情况下,为什么错误没有写入日志。
标签: php nginx ubuntu-16.04 fpm