Thursday, 13 February 2014

Error Reporting in php

Php Error Reporting
Php Error Reporting
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 :-

Error Reporting php
Screenshot1
<?php
$var = 'Alex'
?>




output (Screenshot 2) :-

Error Reporting
Error Reporting
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 in screenshot 3

Error Reporting
Screenshot3
and output is nothing as shown in screenshot 4.

errorreporting
Screenshot4
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).

error reporting
C:\xampp\php folder, we need php.ini file (Screenshot 5).

In (Screenshot 6)

Error Reporting php
Screenshot6
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).

php.ini file
Screenshot7
When you will click on Button Find next, notepad will Error Handling and Logging (Screenshot 8).

Error Handling
Screenshot8
In this way, you will see all states or all setting of error reporting 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 Reporting off as we seen in our Browser (Screenshot 9).

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
Screenshot9
Now Lets change this value to E_All in this Tutorial (Screenshot 10).

error_reporting
Screenshot10

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).

parse error
Screenshot11
It shows Error of “;” which we forget in (Screenshot 1). This was short description on Error Reporting Now read more on More on Error Reporting


No comments:

Post a Comment

Thanks For Comment Will get you Soon..

About Me

Welcome to Extra Tutorials! My name is Mohammed and I am the 22 year writer, website developer, and photographer behind the blog. Thanks for visiting! Tutorials Jackpot… In addition to Developer, I love to develop websites and I love to write. Starting a php Blog was inevitable for me. What began as a simple way to share all of my Tutorials with friends and family has developed into my Part time job.

Mohammed Padela

WHAT IS PHP PROGRAMMING

WHAT IS PHP PROGRAMMING
WHAT IS PHP PROGRAMMING

Follow Us

Popular Posts

Designed ByBlogger Templates