Find out why PHP scripts do not report errors _ php skills

Source: Internet
Author: User
PHP program errors include syntax errors, runtime errors, and logic errors. If the PHP script does not report a syntax error, why:

1. in a general integrated environment, error reports are enabled by default. However, in a linux system, installation using a software package is not required,

Now you can view the PHP configuration file and open the error report =>

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

The code is as follows:


Ini_set ('display _ errors ', 'on');/* display All errors */



2. set the error report level=>

The code is as follows:


Error_reporting = E_ALL;/* The strictest error reporting level, which can be enabled during development */
Error_reporting = E_ALL &~ E_NOTICE/* errors other than notice */
Error_reporting = E_ERROR | E_PARSE | e_CORE_ERROR/* only critical runtime errors, new parsing errors, and core errors are considered */

The above three types are recommended.

Note:How to dynamically set the error report level in the PHP script=>

The code is as follows:


Error_reporting (E_ALL &~ E_NOTICE );



3. after the configuration file is changed, the service must be restarted to take effect.=>

Apache startup:/usr/local/apache2/bin/apachectl start/* recommended */

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

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

In addition, the Red Hat exclusive startup command: service httpd restart

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

In addition, the Red Hat exclusive startup command: service httpd stop

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.