我在我的amazon ec2 linux盒子中运行php 5.5.20。我在终端中完成了以下操作
[root]# cat /etc/php.ini | grep error_log
; server-specific log, STDERR, or a location specified by the error_log
; Set maximum length of log_errors. In error_log information about the source is
;error_log = php_errors.log
;error_log = syslog
error_log = /var/log/httpd/php_errors.log
请注意,error_log
指令未被注释掉。然而,我在我的网站上遇到了错误(即404错误、PDO错误等),但php_errors.log文件甚至没有创建。
我也试过chmod 777 /var/log/httpd/
。。。但即使这样也无助于
我还检查了php.ini
设置中log_errors
指令是否设置为On
确保您正在编辑正确的文件。
我见过EC2用户有类似/etc/php5/apache2/php.ini
的php.ini位置
您也可以在shell中尝试locate php.ini
。