php不显示错误
我在 suse11.0 上的 php 中工作,我的问题是当我输入错误的语法或查询时,它不会显示错误,仅在这种情况下显示空白页面,
谢谢
im working in php on suse11.0 my problem is when i type a wrong syntax or query it doesnt show error only blank page shown at this situtaion
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您可以配置
error_reporting
(另请参阅),并启用错误显示(请参阅< a href="http://php.net/manual/en/errorfunc.configuration.php#ini.display-errors" rel="noreferrer">display_errors
或 ini_set) -- 至少在你的开发机器上在你的 php.ini 文件中,你可以使用
或者,在你的 PHP 代码中:
您可能还想在开发盒上安装Xdebug,以获得良好的stacktraces 发生错误/异常
当然,在您的生产机器上,您可能不希望显示错误; 因此必须根据您的环境进行配置;-)
You might to configure
error_reporting
(see also), and enable the displaying of errors (seedisplay_errors
or ini_set) -- at least on your development machineIn your php.ini file, you'd use
Or, in your PHP code :
You might also want to install Xdebug on your development box, to get nice stacktraces wehn an error / exception occurs
Of course, on your production machine, you probably don't want to display errors ; so that will have to be configured depending on your environment ;-)
几乎可以肯定,
display_errors
在 php.ini 中被禁用。这对于产品服务器来说是一件好事,并且使得开发系统基本上无法使用。
对于开发系统,您可能需要将以下行之一添加到 php.ini 文件中:
或
It is almost certainly the case that
display_errors
is disabled in php.ini.This is a good thing on product servers, and makes development systems basically unusable.
For a development system you probably want to add one of these lines to you php.ini file:
or
创建一个包含以下内容的文件,例如 test.php:
在浏览器中执行它并搜索 php.ini 文件所在的位置。
然后在 php.ini 中打开错误报告和显示错误。
Create a file for example test.php with this content:
Execute it in your browser and search where the php.ini file is located.
Than turn error reporting and displaying errors in php.ini on.
确保 php.ini 中的 error_reporting 已打开
Make sure error_reporting is turned on in php.ini
确保 php.ini 文件中的 display_errors 已打开并将 error_reporting 设置为 E_ALL。
Make sure in you php.ini file that display_errors is on and set error_reporting to E_ALL.
开始你的脚本:
Start your script with:
虽然其他答案确实回答了您的问题,但我只是想指出,最好提供您自己的错误检查例程(或代码),以便您的脚本向用户显示令人愉快的错误消息。
就像是
While the other answers do answer your question, I just wanted to point out that it is best to provide your own error checking routine (or code) so that your script will show pleasant error messages to users.
something like