php 定义('WP_DEBUG',真);不显示错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32266155/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 22:52:53  来源:igfitidea点击:

define('WP_DEBUG', true); not show errors

phpwordpress

提问by Antonio Morales

I enabled the errors in my wp-config file:

我在 wp-config 文件中启用了错误:

define('WP_DEBUG', true);

But this not work, Wordpress continues showing me a white screen, a blank screen with no information.

但这不起作用,Wordpress 继续向我显示一个白色屏幕,一个没有信息的空白屏幕。

How can I solve this?

我该如何解决这个问题?

回答by Yogendra

The below code, inserted in your wp-config.php file, will log all errors, notices, and warnings to a file called debug.log in the wp-content directory. It will also hide the errors so they do not interrupt page generation.

以下代码插入您的 wp-config.php 文件,将所有错误、通知和警告记录到 wp-content 目录中名为 debug.log 的文件中。它还将隐藏错误,因此它们不会中断页面​​生成。

this code you must have to insert BEFORE /* That's all, stop editing! Happy blogging. */ in the wp-config.php file.

您必须在此代码之前插入 /* 就是这样,停止编辑!快乐的博客。*/ 在 wp-config.php 文件中。

// Enable WP_DEBUG mode
define('WP_DEBUG', true);

// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

// Disable display of errors and warnings 
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define('SCRIPT_DEBUG', true);

sorce: https://codex.wordpress.org/Debugging_in_WordPress

来源:https://codex.wordpress.org/Debugging_in_WordPress

回答by Aleksandar Jakovljevic

Add these two lines below the

在下面添加这两行

define('WP_DEBUG', true);

error_reporting(E_ALL);
ini_set('display_errors', 1);

then delete them when you don't need them any more.

然后当你不再需要它们时删除它们。

回答by cgee

You can write this into your .htaccess file.

您可以将其写入 .htaccess 文件。

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag  log_errors on
php_value error_log  /home/path/public_html/domain/PHP_errors.log

Please change the error_log directory.

请更改 error_log 目录。