我接管了一个旧项目,我注意到发送到浏览器的500个响应不包含任何信息。由于我在本地工作,我想看看发生了什么。
我试着用下面的
创建我自己的新文件<?php
throw new Exception("bleh");
echo "test";
?>
确实返回500,但它仍然是一个空响应。这是我的php.conf。除了最后两行,它是安装在Cent OS 7上的yum文件
#
# Cause the PHP interpreter to handle files with a .php extension.
#
<FilesMatch '.php$>
SetHandler application/x-httpd-php
</FilesMatch>
#
# Allow php to handle Multiviews
#
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#
#<FilesMatch '.phps$>
# SetHandler application/x-httpd-php-source
#</FilesMatch>
#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"
# my adds
php_value error_reporting "ALL"
结尾/var/log/httpd/error_log的最后几行是
[Sat Jun 25 17:41:03.269154 2016] [auth_digest:notice] [pid 2804] AH01757: generating secret for digest authentication ...
[Sat Jun 25 17:41:03.269537 2016] [lbmethod_heartbeat:notice] [pid 2804] AH02282: No slotmem from mod_heartmonitor
[Sat Jun 25 17:41:03.280894 2016] [mpm_prefork:notice] [pid 2804] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations
[Sat Jun 25 17:41:03.280915 2016] [core:notice] [pid 2804] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
谢谢你的帮助,我一直在盯着这个,我觉得我错过了一些明显的东西。
我能够解决这个问题,不是通过修改php.conf,而是通过修改/etc/php.ini
,将display_errors
设置为关闭。通过将其设置为On
,浏览器中出现了我想要的错误。