【发布时间】:2011-08-02 02:35:19
【问题描述】:
我可以使用 .htaccess 隐藏 php 错误中的路径
例子:
Notice: Undefined variable: hello in C:\xampp\htdocs\mysite\index.php on line 3
我想使用 .htaccess 隐藏路径或打印一些内容让我知道是否有错误而不打印页面路径:
Notice: Undefined variable: hello on line 3
或
Notice: Undefined variable: hello
或
There is error in your page
编辑:
我把这行放在我的 .htaccess 中 但我无法访问我的网站。出现错误“内部服务器错误” 我该如何解决这个问题
# supress php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0
【问题讨论】:
-
您根本不应该向访问者显示此类错误消息!它们仅适用于开发人员。
-
上下文是什么?您根本不应该从 PHP 解释器输出错误/警告。如果有这样的消息,你必须修复你的脚本。
-
您是否将 PHP 作为模块运行并且您是否拥有“
AllowOverride Options”或“AllowOverride All”权限?否则不能使用php_flagandphp_value。 -
@Gumbo 他做到了。否则他不会看到这样的错误。
-
我无法理解你的问题,因为我在这方面没有太多经验:)