Home  >  Article  >  Backend Development  >  Two reasons why PHP scripts do not report errors_PHP Tutorial

Two reasons why PHP scripts do not report errors_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:28:34834browse

-------------------------------------------------- -------------------------------------------------- ----

There are generally three types of PHP program errors: syntax errors, runtime errors, and logic errors.

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

---------------------@author chenwei ------------- ---------------

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 =>

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 script =>

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

2. Set error reporting level =>

error_reporting = E_ALL; /* The strictest error reporting level, can be turned on during the development stage */

 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 */

Of the above three, the middle one is recommended.

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

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/781922.htmlTechArticle--------------------- -------------------------------------------------- -------------------------- There are generally three types of PHP program errors: syntax errors, runtime errors, and logic errors. ...
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