Intermittent 500 errors due to php.ini handler custom code
-
This is more of a heads-up than a support question:
I recently upgraded PHP & mySQL versions and when logging in to the admin dashboard I noticed 2 things:
1) When moving through the dashboard, pages would randomly fail to load properly; just an unstyled white screen with a vertical list of dashboard links
2) I received this helpful notification from BPS:HUD Check: PHP/php.ini handler htaccess code check PHP/php.ini handler htaccess code was found in your root .htaccess file, but was NOT found in BPS Custom Code.
…followed by a code snippet to be copied & pasted in to the custom code editor:
# PHP/php.ini handler htaccess code
AddHandler application/x-httpd-ea-php73 .php .php7 .phtmlExcellent (so far)! After I pasted it in & clicked encrypt & save, I carried on working in the admin dashboard. BUT the intermittent page loading problem persisted – only in the dashboard. I checked the source code on one of these broken pages and compared with an unbroken page & the code was the same on both. Then I checked the browser debugger and saw this:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
…so I disabled script concatenation using the config file (added this to wp-config.php):
define(‘CONCATENATE_SCRIPTS’, false);This worked as a short term fix and suggested this is a plugin-related problem. So I removed define(‘CONCATENATE_SCRIPTS’, false); and started disabling plugins. As soon as I disabled BPS the problem went away.
After MUCH testing, I determined the problem was:
a) the missing PHP.ini handler code AND
b) the blank spaces before “AddHandler” in the code snippet provided by the BPS plugin.In other words, THIS:
# PHP/php.ini handler htaccess code
AddHandler application/x-httpd-ea-php73 .php .php7 .phtmlSHOULD be THIS:
# PHP/php.ini handler htaccess code
AddHandler application/x-httpd-ea-php73 .php .php7 .phtmlI’m not 100% sure this is completely resolved, but so far, so good (no more broken admin pages).
pk
The topic ‘Intermittent 500 errors due to php.ini handler custom code’ is closed to new replies.