apache 2.2 (ubuntu) 不允许我通过 .htaccess 设置 php 错误报告?
我运行 ubuntu (debian) linux 和 apache 2.2/php 5.2 的服务器有问题,
在 php.ini 中关闭了 display_errors
因为这主要是一个高效服务器,出于开发目的, ,我想要为某些域启用这些错误报告功能。但是当我
设置php_flag display_errors
在测试域的 .htaccess 文件中 时,它根本不起作用:( 所以我必须在 php.ini 中设置 display_errors ,这会影响服务器上的所有网站...如何在本地为一个域设置此设置?
i have a problem with my server which is running ubuntu (debian) linux and apache 2.2/php 5.2
as this is mainly a productive server, display_errors
is turned OFF in the php.ini
for development purposes, i want to enable these error reporting stuff for certain domains. but when i set
php_flag display_errors on
in the .htaccess file of the test-domain, it simply wont work :(
so i have to set display_errors in the php.ini which affects ALL websites on the server... how can is set this locally for ONE domain?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非 PHP 作为 Apache 模块运行,否则无法在
.htaccess
文件中提供 PHP 指令。是这样吗?如果是这样,首先确保文件确实正在被读取。您可以做的一个快速测试是故意在 .htaccess 文件中犯一个语法错误:您的网站应该返回 500 错误消息。如果您将 PHP 作为 CGI 运行,则可能为每个用户在某处都有一个自定义php.ini
文件。最后但并非最不重要的一点是,您可以针对每个应用程序启用错误报告。只需在顶部添加以下代码:
You cannot provide PHP directives in an
.htaccess
file unless PHP runs as Apache module. Is that the case? If so, first make sure the file is actually being read. A quick test you can do is to make a syntax error on purpose in the .htaccess file: your site should return a 500 error message. If you are running PHP as CGI, you probably have a customphp.ini
file somewhere for each user.Last but not least, you can enable error reporting in a per-application basis. Just add this code on top:
您的虚拟主机中是否启用了
AllowOverride
?如果它设置为“None”,那么 Apache 将完全忽略 .htaccess 文件。Is
AllowOverride
enabled in your vhost? If it's set to 'None', then Apache will utterly ignore .htaccess files.