What should I do if php does not display error messages?

藏色散人
Release: 2023-03-05 12:48:02
Original
3179 people have browsed it

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.

What should I do if php does not display error messages?

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
Copy after login

Just change the following two items!

error_reporting = E_ALL
display_errors = On
Copy after login

What should I do if php does not display error messages?

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!