Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尽管有PHP.ini设置,PHP仍不记录脚本错误_Php_Nginx_Fpm - Fatal编程技术网

尽管有PHP.ini设置,PHP仍不记录脚本错误

尽管有PHP.ini设置,PHP仍不记录脚本错误,php,nginx,fpm,Php,Nginx,Fpm,我将PHP-FPM与NGINX一起使用,无法获取错误日志以正确使用PHP-FPM 这是我的php.ini,相关部分: error_reporting = 'E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE' error_log = /var/www/logs/php-scripts.error.log log_errors = 'On' display_errors = 'Off' display_startup_errors =

我将PHP-FPM与NGINX一起使用,无法获取错误日志以正确使用PHP-FPM

这是我的
php.ini
,相关部分:

error_reporting = 'E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE'
error_log = /var/www/logs/php-scripts.error.log
log_errors = 'On'
display_errors = 'Off'
display_startup_errors = 'Off'
html_errors =  'Off'

open_basedir = /var/www/html/:/var/www/.tmp/:/var/www/logs/
upload_tmp_dir = /var/www/.tmp
www-pool.comf
(由PHP-FPM主进程加载的配置)的相关片段:

/var/www/logs/
可由
www-data
写入-用户PHP-FPM和web服务器运行为

现在,如果我在
index.php中执行此操作:

error_log('Some error')

错误消息可以毫无问题地找到
/var/www/logs/php scripts.error.log
。但是,当我尝试触发这样的错误时:

trigger_error('Some error',E_USER_警告)

该错误未记录在日志文件中。此外,当我启动故意破坏的PHP脚本时,屏幕上会出现500个内部服务器错误,但PHP错误日志中不会记录任何内容,例如:

// index.php
<?php
echo 'Trigger error'
//index.php

删除错误报告中的引号以及其他设置,您的php.ini应该如下所示:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE
error_log = /var/www/logs/php-scripts.error.log
log_errors = On
display_errors = Off
display_startup_errors = Off
html_errors =  Off

open_basedir = /var/www/html/:/var/www/.tmp/:/var/www/logs/
upload_tmp_dir = /var/www/.tmp

就这样。但是,为了便于参考,允许在文档中使用双引号:“您可以将字符串括在双引号中include_path=“.:/usr/local/lib/php”谢谢,尽管这通常仅适用于文件路径或其他文本字符串。按照惯例,错误报告值和开/关通常不带引号:)
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE
error_log = /var/www/logs/php-scripts.error.log
log_errors = On
display_errors = Off
display_startup_errors = Off
html_errors =  Off

open_basedir = /var/www/html/:/var/www/.tmp/:/var/www/logs/
upload_tmp_dir = /var/www/.tmp