Home>Article>Backend Development> What should I do if php does not display error messages?
Solution to php not displaying error messages: First find and open the "php.ini" file; then modify the content to "error_reporting = E_ALL" and "display_errors = On"; finally save the changes.
Recommended: "PHP Video Tutorial"
Solution to php not outputting error message
After installing lnmp, the browser page does not output errors, but the error message can be seen in the nginx error log. The reason is that php-fpm does not output error messages by default, because when we installed yum, we used it by default It is the php.ini configuration environment of the production environment. This must be blocked in the production environment, otherwise people will see all your mistakes and your code will be unsafe.
Solution:
vim /etc/php.ini
Just change the following two items!
error_reporting = E_ALL display_errors = On
If you want to temporarily output the error on the page, just add the following code at the top of the page where you want to output the error!
error_reporting(-1); ini_set('display_errors', 1);
See it, the cute error page is out again!
The above is the detailed content of What should I do if php does not display error messages?. For more information, please follow other related articles on the PHP Chinese website!