无法启用 php display_errors [英] Cannot get php display_errors enabled
问题描述
嘿,我知道有一些关于这个主题的帖子,我已经把它们都搜索了!
Hey i know there are a few posts regarding this topic and i have scoured them all!
无论我做什么,我都无法在 php 中启用 display_errors 设置!!!
I cannot not enable the display_errors setting in php no matter what i do!!!
我正在使用安装了 php 5.3 并运行 apache2 的虚拟机.我已经尝试了所有我能想到的方法来使显示错误正常工作,但似乎没有任何效果.
Im using virtual box with php 5.3 installed with apache2 running. i have tried everything i can think of to get display errors working but nothing seems to work.
我在我的 .htaccess 文件中设置了 php_flag display_errors 我什至直接在 php.ini 文件中启用了它
I have set php_flag display_errors on in my .htaccess file i have even enabled it directly in the php.ini file
display_errors = 1
也试过了
display_errors = On
我正在使用启用 apache 站点的默认设置,我需要在这里做些什么才能使其正常工作吗?我从来没有遇到过使用 mamp 在我的 mac 上运行 php 的问题.
I am using the defaults for apache sites-enabled is there something i need to do here to get this to work?? i have never had this problem running php on my mac using mamp.
任何建议将不胜感激,这让我发疯!
Any suggestions would be greatly appreciated this is driving me nuts!
推荐答案
通常也可以在 PHP 脚本中启用它:
You can also enable it in your PHP script usually:
ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
error_reporting(E_ALL);
如果这没有帮助,请先尝试快速解决方法:
If that doesn't help, then try a quick workaround first:
set_error_handler("var_dump");
可用于复制原始行为,如果它被其他情况抑制.
Could be used to replicate the original behaviour, if it's suppressed by some other circumstance.
请记住,这仅适用于启用运行时错误.如果您怀疑解析错误,您肯定必须在 php.ini/.htaccess/.user.ini.-- 否则用上面的指令制作一个包装 test.php
脚本,然后 include()
错误的脚本.
Take in mind, this only works for enabling runtime errors. If you suspect parse errors, you'll definitely have to enable error display in the php.ini / .htaccess / .user.ini. -- Else make a wrapper
test.php
script with above instructions, theninclude()
the faulty script.
这篇关于无法启用 php display_errors的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!