It is pre requisites for now that your pc is installed with PHP 5.X and Apache web server. If it is not set yet and facing trouble configuring PHP with Apache web server then find this post on configure PHP 5.X with Apache web server explained step by step. We will discuss here about errors, warnings and notices being displayed when you run the PHP source code and publish through a web server. First of all let us understand these terms.
Notice is something which will indicate developer that some of the statements in the program are not written or coded efficiently. Of course, this doesn’t mean that it is coded wrongly. Mostly it is an advice to the developer to review and correct the style of coding. By showing Notices, PHP confirms that the execution of the program is not going to be stopped but review on the code is required and corrected if possible.
Warning is bit more stressed compare to Notices and says, a wrong type of style is taken for writing the source code and this may lead to the error when more components in program is integrated with this particular code or for other cause. Warnings too does not stop the execution of the program just warns the developer to take action to correct the code.
Errors are fatal. It completely stops the execution of the program running and non recoverable. Sometimes developers and software testers calls it as `crash`. Developer has to find the root cause of this `crash` and correct it and then run the program again otherwise it is not possible to display the expected information generated by PHP source code.
There are certain directives and techniques to handle such Notices, Warnings and Errors to display or not to display at runtime. When it comes to configuration of PHP, things turns again to php.ini file of the PHP5.X distribution folder. Directives in this file are specified with syntax ‘Directive = Value’ format and it is case sensitive i.e. ‘Direvtive = Value’ is different than ‘directive = value’.
Find the block “Error handling and logging” in the php.ini file. It is mostly commented in the file. You need to point out the specific directive `error_reporting` and the value assigned to it. Check the whole block and follow instructions mentioned in that as per your server configuration. Most of startup developers and students generally are developing stage and they need to understand cause of this warnings and notices and errors into bit details, they keep the configuration as follows:
“error_reporting = E_ALL”
This means show all Errors, Warnings and Notices which PHP is generating at runtime. This is mostly at development machine configuration so developers can take corrective actions while coding by seeing them on the screens. There are many of values can be set referring the php.ini file and the error reporting block. All values are written in the commented form, just select it as per your requirement, copy and paste against the respective directives.
I will be marking few of other directives in my next post which are extremely important to understand while we develop and test the PHP source code.
0 Comment