Home » Php » php – Why is codeigniter not logging error!

php – Why is codeigniter not logging error!

Posted by: admin July 12, 2020 Leave a comment

Questions:

For some reason I cannot get the error logging to work, I’m getting the white screen of death and I’m hoping an error log will be able to shed some light on the situation!

My index.php has

error_reporting(E_ALL);

I have also made sure that the system/logs directory has appropriate permissions,

If the page fails to load like whats happening does an error even GET logged? If it doesn’t I have a huge amount of code that I would have to search through for syntax errors, any advice on how to make the php errors spit out would help!

Also, Here’s my config

`
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to 
| determine what gets logged. Threshold options are:
| 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
|
| 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'] = 1;

/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/logs/ folder.  Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
`

All that’s in my system/logs is an index.html which has a 403 error in it.

How to&Answers:

If the page is failing to load because of a parse error, then it’ll never execute

error_reporting(E_ALL);

so you script will never know to output the error. Edit your php.ini file to make sure you have:

error_reporting = E_ALL
error_log = "/path/to/some/apache/writable/file"