| Error Reporting in php |
This is a tutorial for Error Reporting. Why Error Reporting is important for development? When we have to off error reporting ? The answer is when we are not developing or when we are releasing codes to the web-server for public use.
For Example (Screenshot 1) Codes :-
1
2
3
4
5
| <?php$var = 'Alex'?> |
output (Screenshot 2) :-
Output of this code will be blank because we does not put semi colon “;” at defining the string, it will also not show us error at that time error reporting is useful to us. Same example you can see inscreenshot 3
and output is nothing as shown in screenshot 4.
We are Missing semi colon “;” , now my error reporting is off in php.ini file or in php configuration files so, I should have to turn on.
Now If you open your C:\xampp\php folder, we need php.ini file (Screenshot 5).
In (Screenshot 6)
you will see php.ini file in which you will see a warning, About php.in, etc. Now in notepad Edit > Find, and find error_reporting (Screenshot 7).
When you will click on Button Find next, notepad will Error Handling and Logging (Screenshot 8).
In this way, you will see all states or all setting of errorreporting like E_All, E_ERROR, E_WARNING, E_PARSE, E_NOTICE, E_STRICT, E_Core_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, E_USER_ERROR, E_USER, WARNING, E_USER_NOTICE , etc with all the description. By Default, error_reporting value is zero. Now this is error Reportingoff as we seen in our Browser (Screenshot 9).
Now Lets change this value to E_All in this Tutorial (Screenshot 10).
Always Remember when ever you change php setting or php configuration file you should refresh Xampp server by control panel apache and MySQL stop and start button. E_All is for all errors and warnings (Don’t include E_Strict). Now you will see (Screenshot 11).
It shows Error of “;” which we forget in (Screenshot 1).
Read More Extra Tutorials
No comments:
Post a Comment