Explore the reasons why PHP scripts do not report errors_PHP Tutorial

WBOY
Release: 2016-07-13 10:28:23
Original
774 people have browsed it

So if the PHP script does not report syntax errors, what would be the reason:

1. In general integrated environments, error reporting is enabled by default; but in Linux systems, this is not necessarily the case when using software packages to install.

At this point you can view the PHP configuration file and open the error report =>

Copy code The code is as follows:

 display_errors = On   /* PHP configuration file path: /uer/local/php/etc /php.ini */


Note: How to dynamically set the php.ini configuration file in PHP scripts =>

Copy code The code is as follows:

ini_set('display_errors', 'On'); /* Display all errors*/


2. Set error reporting level =>

Copy code The code is as follows:

 error_reporting = E_ALL; /* The most stringent error reporting level, which can be turned on during the development phase* /
 error_reporting = E_ALL &~ E_NOTICE /* Errors other than notice*/
 error_reporting = E_ERROR | E_PARSE | e_CORE_ERROR /* Only fatal runtime errors, new parsing errors and core errors are considered*/

 The above three, the middle one is recommended.

Note: How to dynamically set error_reporting error reporting level in PHP script =>

Copy code The code is as follows:

 error_reporting(E_ALL &~ E_NOTICE);


3. After changing the configuration file, you need to restart the service to take effect =>

Start Apache:/usr/local/apache2/bin/apachectl start /* Recommended */

In addition, Red Hat Linux proprietary startup command: service httpd start

Apache restart: /usr/local/apache2/bin/apachectl restart

In addition, Red Hat’s proprietary startup command: service httpd restart

Stop Apache: /usr/local/apache2/bin/apachectl stop

In addition, Red Hat’s proprietary startup command: service httpd stop

Nginx restart: /usr/local/nginx/sbin/nginx -s reload /* Smooth restart */

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/788642.htmlTechArticleSo if the PHP script does not report a syntax error, what would be the reason: 1. In a general integration environment, it will be by default Turn on error reporting; but in Linux systems, this is not necessarily the case when using software packages to install...
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!