Error Reporting Not Working in PHP

I just wonder why error reporting not working php. In this page i will show you how to show error massage in php by setting some code snipet, which would be easy for a developer to debug the code and fix the issues. Sometimes you wrote a code without any proper IDE and some mistake has been done, then how to find the parse error. so for that php also provide us a predefind function.



Now just have a look the below code.

 

Put the above code in your config.php file or header.php or index.php. Now you will able to see the parse error in your php code. If not open your php.ini and go to below code and enable this.

display_errors = on;



But this the case of the core php, But if you are working in any framework like, codeigniter and not able to display any error after code running your project in browser, then you have to follow simple setting.
Open your index.php

 

But if you want to know log files, then in codeigniter you have to set, log_threshold in config.php file. see below code.

/*
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you’ll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/



$config[‘log_threshold’] = 4;

It will create a file in side logs folder in side the application folder.



Advertisements