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);
?