In our Apache access logs, we've noticed users occasionally getting a 500 error. It is likely a database query problem within our CodeIgniter code. We can't be sure how to fix it until we see the error. So, I'm trying to get the error printed to the error log and have been failing at that. Here's where I'm at:

  • Turned on error logging in Apache's php.ini file (/etc/php/7.2/apache2/php.ini) with the line: log_errors = On
  • Error reporting in CodeIgniter is set to: error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
  • The site's Apache vhosts config specifies an error log (/var/log/apache2/minans_error.log) which is getting populated with notices about IPs we've blocked in our .htaccess file, but not with 500 errors.
  • The error max length in php.ini has been set to 0 with the line: log_errors_max_len = 0
  • I forced log_errors on in CodeIgniter: ini_set('log_errors', 1);

  • I changed the permissions on the error log file to 666.

  • I forced the error log file in CodeIgniter with: ini_set('error_log', '/var/log/apache2/minans_error.log');

I'm hoping someone can tell me where I'm going wrong, suggest other things to try, or if I'm misunderstanding Apache's ability to log errors to point that out to me.

  • What is Apache's error log level? What "LogLevel" directives do you find in its configuration? Commented Jun 10, 2020 at 18:05
  • /etc/apache2/apache2.conf has LogLevel warn
    – Christian
    Commented Jun 10, 2020 at 18:35

1 Answer 1


In testing I wrote some test code with a PHP error. When attempting to load the page a 500 error occurred and the PHP error was recorded to the error log.

We suspect, the 500 errors our users are getting is a database query error. This is being handled by CodeIgniter and not triggering Apache's error logging. In CodeIgniter's config.php file I set $config['log_threshold'] = 1. Now CodeIgniter it logging errors it captures to it's application/logs directory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .