Home » BLOG » Web development » How to enable PHP error logging in CodeIgniter

How to enable PHP error logging in CodeIgniter

category:  CodeIgniter, Web development

When you deploy your application to the production server, it is a good practice that you enable the PHP error logging file for your application. Because we don’t enable the PHP error reports on the production, we will create the error logging file to collect the PHP error on the production for us.

In CodeIgniter, enable the error logging is simple since CodeIgniter has this function built-in.

Below is the steps you can follow.

  • Make your application/logs folder writable on your production server
  • In application/config/config.php, set $config[‘log_threshold’] as 1 (You can set a higher number. You can read from the comments in the config.php file)

Once you set the two steps above, your application will create a log.php under application/logs folder if there is some PHP error occurs.

Hope this small trick will be useful for you.