How to let discuz display php errors: You can use the error_reporting function to achieve this. The error_reporting function can set the PHP error reporting level, such as [error_reporting(report_level)].
Recommended: "discuz Tutorial"
You will often encounter the phenomenon of blank pages. In fact, this is due to PHP encountered an error message when running and terminated the operation, and our configuration parameters prohibited PHP from outputting error message reports on the page, so the page everyone saw was blank. So what about the error message reported by PHP? You can follow the tutorial below to enable it.
1. Set the error level of PHP by configuring the parameters in php.ini
You can add a line in the appropriate position in php.ini
The following is the quoted content:
error_reporting = E_ALL
Note: The implementation in php.ini gives some examples. For example, my local php.ini has the following
The following is the quoted content:
; Examples:; - Show all errors, except for notices and coding standards warnings;error_reporting = E_ALL & ~E_NOTICE; - Show all errors, except for notices;error_reporting = E_ALL & ~E_NOTICE | E_STRICT; - Show only errors;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR; - Show all errors except for notices and coding standards warnings;error_reporting = E_ALL & ~E_NOTICE
I just need to add error_reporting = E_ALL under these lines of code and then restart the web service
2. Set the PHP error level through the PHP function error_reporting
If you do not have the authority to modify php. Parameter configuration in ini, you can set the error level through this function.
How to use the error_reporting() function
error_reporting(report_level)
If the parameter level is not specified, the current error level will be returned.
Any number of the above options can be "or" connected (using OR or |), so that all required error levels can be reported. For example, the following code turns off user-defined errors and warnings, performs certain operations, and then returns to the original error level:
The following is the quoted content:
//禁用错误报告error_reporting(0);//报告运行时错误error_reporting(E_ERROR | E_WARNING | E_PARSE);//报告所有错误error_reporting(E_ALL);那么我们就可以把论坛里的 include/common.inc.php文件里的 error_reporting(0);
Modify to
error_reporting(E_ALL);
Then save, so you can see the error message reported by PHP
The above is the detailed content of How to make discuz show php errors. For more information, please follow other related articles on the PHP Chinese website!