不显示PHP错误 [英] Not displaying PHP errors
问题描述
我归结问题,并使其干净,使其有希望会更容易让你帮我。
我有一个非常简单的code:
< PHP
回声世界,你好;
?>
这完全运行正常。
如果我运行下面的code(分析错误)我没有得到任何错误,但文本Hello World仍显示:
< PHP
回声世界,你好;
piwejfoiwjefoijwef
?>
如果我的code之前把解析错误然而,它不显示的Hello world:
< PHP
piwejfoiwjefoijwef
回声世界,你好;
?>
当我打印的phpinfo(在同一文件中,同一个目录下),我有以下设置:
上的display_errors
display_startup_errors在
把error_reporting 1
如果我尝试还设置了错误报告的脚本中,并以下列code运行它,我还没有得到任何错误或警告,但文字显示的Hello world:
< PHP
使用error_reporting(E_ERROR | E_WARNING | E_PARSE);的ini_set('的display_errors','1');
回声世界,你好;
owieufpowiejf
?>
我的php.ini文件有下列值(和我已经重新启动Apache的):
的error_reporting = E_ERROR&安培; 〜E_DE preCATED
的display_errors =开
display_startup_errors =开
我运行的Apache / PHP / MySQL的亚马逊AMI与64位AWS EC2。我不是跟服务器配置,知识渊博。当我转移到亚马逊服务器的错误开始。除了错误报告服务器和Apache / PHP运行完美。
请指导我我能做些什么来解决这个问题。
谢谢!
这是一个通知。
的error_reporting(E_ALL);
显示它。
code我用:
< PHP 使用error_reporting(E_ALL);的ini_set('的display_errors','1');
回声世界,你好;
owieufpowiejf?>
输出:
您好世界
注意:使用未定义的常量owieufpowiejf的 - 假设owieufpowiejf中/ code / 14B4LY第5行
块引用>这是因为它不是一个语法错误,它认为它作为一个常量,并试图解析它作为一个字符串。并把正常的字符串是一个有效的语句。
I've boiled down the problem and made it clean so that it hopefully will be easier for you to help me.
I have a very simple code:
<?php echo "Hello world"; ?>
This runs perfectly fine.
If I run the following code (parse error) I do not get any errors but the text "Hello world" is still displayed:
<?php echo "Hello world"; piwejfoiwjefoijwef ?>
If I place the parse error before the code it does however not display "Hello world":
<?php piwejfoiwjefoijwef echo "Hello world"; ?>
When I print phpinfo (in the same file, same directory) I have the following settings: display_errors On display_startup_errors On error_reporting 1
If I try to also set the error reporting inside the script and run it with the following code I still do not get any errors or warning but the text "Hello world" is displayed:
<?php error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('display_errors', '1'); echo "Hello world"; owieufpowiejf ?>
My php.ini file has the following values (and I have restarted Apache):
error_reporting = E_ERROR & ~E_DEPRECATED display_errors = On display_startup_errors = On
I am running Apache / PHP / MySQL on the Amazon AMI with on a 64-bit AWS EC2. I am not that knowledgeable with server configurations. The errors started when I transitioned to the Amazon server. Besides error reporting the server and Apache/PHP runs flawlessly.
Please guide me in what I can do to fix the problem.
Thanks!
解决方案That is a notice.
error_reporting(E_ALL);
reveals it.
Code I used:
<?php error_reporting(E_ALL); ini_set('display_errors', '1'); echo "Hello world"; owieufpowiejf ?>
Output:
Hello world
Notice: Use of undefined constant owieufpowiejf - assumed 'owieufpowiejf' in /code/14B4LY on line 5
That's because it's not a parse error, it thinks of it as a constant and tried to parse it as a string. And placing a normal string is a valid statement.
这篇关于不显示PHP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!