Two reasons why PHP scripts do not report errors

Source: Internet
Author: User

Bytes --------------------------------------------------------------------------------------------------

PHP program errors include syntax errors, runtime errors, and logic errors.

If the PHP script does not report a syntax error, why:

------------------------ @ Author chenwei <www. chenwei. ws> ---------------------------

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

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

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

 

2. Set the error report level =>

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 of error_reporting in the PHP script =>

Error_reporting (E_ALL &~ E_NOTICE );

 

3. After changing the configuration file, restart the service 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 */

Bytes -------------------------------------------------------------------------------------------------

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.