Home>Article>Backend Development> How to enable error prompts in ubuntu php

How to enable error prompts in ubuntu php

藏色散人
藏色散人 Original
2020-10-07 00:43:21 1980browse

How to enable error prompts in ubuntu php: First open the php.ini file; then modify the content to "/display_errors = On"; then modify Apache's httpd.conf; and finally restart Apache.

How to enable error prompts in ubuntu php

Recommended: "PHP Video Tutorial"

is learning PHP When doing so, turning on error prompts can enable beginners to quickly find the source of code errors. However, after installing PHP, the error prompt function is turned off by default, so it needs to be turned on again.

The opening steps are as follows:

1. Open the php.ini file.

In Ubuntu system, this file is in: /etc/php5/apache2 directory.

sudo vim /etc/php5/apache2/php.ini

2. Search and modify the following line, change the Off value to On

After opening the php.ini file, use

##

##display_errors = Off this line of code. The results are as follows:## Change the value to On.3. Press the "Esc" key to exit the edit mode, and search for the following line according to the method in step 2error_reporting = E_ALL & ~E_NOTICEOr search:

4. Modify Apache’s httpd.conf,Under the Ubuntu system, this file is in the /etc/apache2/ directory. This is a blank file.

Add the following two lines:

## PHP_FLAG Display_ERRORS onPHP_VALUE ERROR_Reporting 2039# 5. Restart Apache, and it is OK.

Restart command: :sudo /etc/init.d/apache2 restart

## I deliberately put After correcting the code of a php file and then running it, you can see an error message.



The above is the detailed content of How to enable error prompts in ubuntu php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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