Wordpress不允许PHP错误

时间:2011-07-09 17:07:29

标签: php wordpress

我目前正在使用一个使用Wordpress的网站。但是它使调试有点困难,因为我无法在页面上显示PHP错误。相反,我得到死亡的白色屏幕。

我尝试在wp-config.php文件和php.ini文件中添加定义无效。我也无法在.htaccess中添加标志,因为服务器处理apache / php的方式。

我注意到的一件事是Wordpress之外的任何页面都显示错误。

有什么建议吗?

4 个答案:

答案 0 :(得分:6)

尝试将ini_set("display_errors","2"); ERROR_REPORTING(E_ALL);添加到index.php文件。

答案 1 :(得分:2)

您可以访问/ var / log / httpd / error_log吗?如果你在Linux上,那么(默认情况下)会显示错误。

答案 2 :(得分:1)

在根目录的.htaccess文件中添加以下行。

php_flag display_errors on

答案 3 :(得分:1)

在wp-config.php文件中将开发WordPress安装设置为true WP_DEBUG常量非常有用:

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/

define('WP_DEBUG', true);

您将看到更多内容,包括关于弃用员工使用情况的PHP注意和WordPress消息。