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

How to enable PHP error logging in CodeIgniter

Updated:   CodeIgniter, Web development 1 min read

Your support helps keep this blog running! Secure payments via Paypal and Stripe.


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.


Your support helps keep this blog running! Secure payments via Paypal and Stripe.


Senior WordPress & WooCommerce Developer

Senior WordPress & WooCommerce Developer

I’m a professional WordPress and WooCommerce developer based in Chiang Mai, Thailand, with over a decade of experience creating fast, secure, and scalable websites. From custom themes and plugins to full WooCommerce stores, I help businesses build a strong and reliable online presence. Need a developer you can count on? View my portfolio or get in touch to discuss your project.