1. Disable notice error prompt
1. Change error_reporting in the php. Ini file.
Changed:
The code is as follows: |
Copy code |
Error_reporting = E_ALL &~ E_NOTICE |
2. If you cannot operate the php. Ini file, you can use the following method:
Add the following code to the page where you want to disable the notice error prompt:
The code is as follows: |
Copy code |
Error_reporting (E_ALL ^ E_NOTICE ); |
In this case, no more prompts will be prompted.
II. Disable all error messages
Php. ini
Open the PHP. Ini file in the php installation directory.
The code is as follows: |
Copy code |
Find display_errors = On and change it to display_errors = off. |
Note: If you have copied the PHP. ini file to the windows directory, you must change display_errors = On in c: windows/php. ini to display_errors = off.
Php program enabled
The code is as follows: |
Copy code |
<? Php // Disable error reporting Error_reporting (0 ); // Report running errors Error_reporting (E_ERROR | E_WARNING | E_PARSE ); // Report all errors Error_reporting (E_ALL ); ?>
|
Disabling the error message in terms of performance will increase the server performance load a lot.
Test 1:
Disable error display to test the performance of uninitialized and initialized variables in the 10000000 cycle.
The initialization code of the variable is as follows:
The uninitialized loop code of the variable is as follows:
Test score:
Initialization: average 5.28 seconds
Uninitialized: average 17.2 seconds
Performance Gap: 3.25 times
Average time table:
We can see that disabling PHP error output does not close the php kernel's handling of errors. If a large number of Notice-level errors exist in the code, the php program performance will be reduced.