加入收藏 | 设为首页 | 会员中心 | 我要投稿 商洛站长网 (https://www.0914zz.com/)- AI应用、CDN、边缘计算、云计算、物联网!
当前位置: 首页 > 综合聚焦 > Ubuntu > 正文

Ubuntu PHP5 / Apache2 – 显示500错误而不是错误消息

发布时间:2020-12-15 11:28:03 所属栏目:Ubuntu 来源:互联网
导读:以下脚本未向浏览器输出错误消息.相反,它会导致HTTP Error 500响应. ?phperror_reporting(E_ALL);ini_set(display_errors, On);phpinfo();echo test asdf // This should error? 想法?这是ubuntu上基本的php5 / apache2安装. httpd.con

以下脚本未向浏览器输出错误消息.相反,它会导致HTTP Error 500响应.

<?php
error_reporting(E_ALL);
ini_set('display_errors','On');

phpinfo();

echo "test" asdf // This should error
?>

想法?这是ubuntu上基本的php5 / apache2安装. httpd.conf是空白的,没有.htaccess文件.

error.log文件显示错误消息:

syntax error,unexpected T_STRING,expecting ‘,’ or ‘;’

哪个是对的.

<?php
error_reporting(-1);
ini_set('display_errors',1);
ini_set('display_startup_errors',1);

phpinfo();

echo "test" asdf // This should error
?>

在error_reporting -1中显示甚至超过E_ALL,对于display_errors,我使用值1而不是On.

http://php.net/manual/en/function.error-reporting.php
http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

编辑:我得到了答案!

If the script has a parse error that prevents it from running,this also prevents it from > changing a PHP setting.

https://serverfault.com/questions/242662/ubuntu-php5-apache2-displaying-500-error-instead-of-error-message

(编辑:商洛站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读