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

藏色散人
Release: 2023-03-07 22:26:02
Original
1992 people have browsed it

The solution to php not outputting error information: first open "php.ini"; then modify the content to "error_reporting = E_ALLdisplay_errors = On"; finally save the changes.

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

#The operating environment of this article: Windows 7 system, PHP 7.1 version, Dell G3 computer.

Recommended: "PHP Video Tutorial"

Operating environment for this tutorial : Windows 7 system, PHP 7.1 version, this method is suitable for all brands of computers.

Solution to php not outputting error messages

After installing lnmp, the browser page does not output errors, but the error message can be seen in the nginx error log. The reason php-fpm does not output error messages by default, because when we install yum, we use the php.ini configuration environment of the production environment by default. This must be blocked in the production environment, otherwise people will see all your errors and your code will be It's not safe anymore.

Solution:

vim /etc/php.ini
Copy after login

Just change the following two items!

error_reporting = E_ALLdisplay_errors = On
Copy after login

What should I do if php does not output 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 output error messages?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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!