PHP off page error prompt

Source: Internet
Author: User

Close PHP Error script prompt is the program on the line must do one thing, that is, no matter how the program error, we can not let the wrong log on the server to everyone to see, let me summarize two ways to close the PHP error script tips

The simplest way is to add the following code directly to the PHP program code:
The code is as follows:
Error_reporting (e_all^e_notice^e_warning);


You can turn off all notice and warning levels of errors.
Put this statement in your script's function include file, usually in config.php or conn.php to control the output.
Of course, I can also set the method in PHP.ini as follows
Open the php.ini file in the PHP installation directory
Find display_errors = on modified to Display_errors = Off
Note: If you have copied the php.ini file to the Windows directory, you must also change the Display_errors = on in C:windows/php.ini to Display_errors = Off
Resolution for display_errors = off invalidation in PHP. ini
Problem:
PHP settings file PHP. ini is already set display_errors = Off, but during the run, the error message appears on the Web page.
Solve:
Open the php.ini file in the PHP installation directory
Find log_errors = off modified to Log_errors = On
Find error_log = filename modified to error_log= "D:phperrlogphp_error.log" (Here's the directory and filename d:phperrlogphp_error.log whatever you take)
Note: If you have copied the php.ini file to the Windows directory, you must also put the C:windows/php.ini file.
In addition Php_error.log must have user's modify and write permission at least, otherwise cannot output error log.

Often see error_reporting (7) straight meaning: Set the level of error message return.



However 7=1+2+4
It's just a mistake. 1 e_error 2 e_warning 4 e_parse

The code is as follows:

<?php
//Disable error reporting  
error_reporting (0);  
//Report run-time error  
Error_reporting (E_error | e_warning | E_parse);  
//Report all errors  
error_reporting (E_all);  
?

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.