Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Codeigniter to report all errors?

I had a line - $autoload['libraries'] = array('database');, in CI's autoload.php. Because of this I was getting a blank page. When I removed the 'database', option then I started getting the output.

Now my question is not how to configure the database, but how to configure CI to speak its mind. When 'database' was enabled all I got was a complete blank page. No error in php log, no error in Apache log, no error in CI log. In PHP I have set E_ALL. In my CI config I have set log_threshold to 4, i.e. all messages should be logged. What more do I need to do?

like image 611
AppleGrew Avatar asked Sep 10 '11 07:09

AppleGrew


People also ask

How do I get errors in CodeIgniter?

You can find the log messages in application/log/. Make sure that this directory is writable before you enable log files. Various templates for error messages can be found in application/views/errors/cli or application/views/errors/html.

How do I enable PHP error reporting?

The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);

How do I enable error reporting in ci4?

CodeIgniter default environment is development and so error reporting by default in turn on state, if you want to turn off reporting then change the environment value(in the top of the main index. php) to production or testing. The above method will work with only For >= 2.

What is $this in CodeIgniter?

$this refers to the current object. Whenever you create an instance like this: $something = new SomeClass(); Then $this refers to the instance that is created from SomeClass , in this case $something .


1 Answers

It depends on your version of CI. For < 2.x edit the top level index.php and adjust the error_reporting function to use E_ALL"

error_reporting(E_ALL);

For >= 2.x edit the top level index.php and make sure ENVIRONMENT is set as:

define('ENVIRONMENT', 'development');

which sets the error_reporting to E_ALL.

like image 147
davidethell Avatar answered Sep 19 '22 08:09

davidethell