The way to view the error information when reporting a 500 error in php is to add [ini_set("display_errors","On"); error_reporting(E_ALL);] to the code.
The operating environment of this article: windows10 system, php 7.3, thinkpad t480 computer.
When debugging PHP code, we need to quickly locate the error through error prompts, and then modify the code.
Usually we use two methods to turn on error prompts, one is to directly modify the php.ini configuration file, the other is to add [ini_set("display_errors", "On"); in the php code 】.
So when we are debugging the code, if a 500 error occurs, how should we check the error message?
Specific method:
Add the following two lines of code to the execution code
ini_set("display_errors","On"); error_reporting(E_ALL);
Free learning video sharing:Programming video
The above is the detailed content of How to check the error message when php reports 500 error. For more information, please follow other related articles on the PHP Chinese website!