Home > Backend Development > PHP Tutorial > Turn on the php error prompt of lamp under ubuntu

Turn on the php error prompt of lamp under ubuntu

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-08 09:25:35
Original
855 people have browsed it

Enable the php error prompt of lamp under ubuntu

The default lamp mode under ubuntu does not have php syntax error prompt. If you want to enable it, you need to modify a few places:

1. Open the php.ini file.

This file is in the /etc/php5/apache2 directory. You need to modify the permissions of this file to write.

<ol>
<li><span><span>sudo chmod 777 /etc/php5/apache2/php.ini  </span></span></li>
<li><span> </span></li>
</ol>
Copy after login

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

<ol>
<li><span><span></span><span>display_errors</span><span> = </span><span>Off</span><span> </span></span></li>
<li><span> </span></li>
</ol>
Copy after login

3. Search for the following line

<ol>
<li><span><span></span><span>error_reporting</span><span> = </span><span>E_ALL</span><span> & ~E_NOTICE  </span></span></li>
<li><span> </span></li>
</ol>
Copy after login

or search:

<ol>
<li><span><span></span><span>error_reporting</span><span> = </span><span>E_ALL</span><span> & ~E_DEPRECATED  </span></span></li>
<li><span> </span></li>
</ol>
Copy after login

and modify it to

<ol>
<li><span><span></span><span>error_reporting</span><span> = </span><span>E_ALL</span><span> | E_STRICT  </span></span></li>
<li><span> </span></li>
</ol>
Copy after login

4. Modify Apache’s httpd.conf,

this file In the /etc/apache2/ directory, this is a blank file. This file also needs to be modified with permissions.

<ol>
<li><span><span>sudo chmod 777 /etc/apache2/ httpd.conf  </span></span></li>
<li><span> </span></li>
</ol>
Copy after login

Add the following two lines:

<ol>
<li><span><span>php_flag display_errors on  </span></span></li>
<li><span> </span></li>
<li><span>php_value error_reporting 2039  </span></li>
<li><span> </span></li>
</ol>
Copy after login

5. Restart Apache and it will be OK.

Restart command:

<ol>
<li><span><span>sudo /etc/init.d/apache2 restart  </span></span></li>
<li><span> </span></li>
</ol>
Copy after login

ok! The error message is successfully enabled! The above is how to turn on the PHP error prompt of LAMP under Ubuntu.

The above introduces the PHP error prompt when turning on lamp under Ubuntu, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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