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.