500 Internal Server Error (random) on Wordpress sites

Not sure what is causing 500 Internal Server Error on Wordpress sites, mostly random stuff. No related errors recorded at the time when issue occurs. It looks like Apache server times out on WP scripts execution.

Virtualmin running on CentOS 6.5

Any clue what is going on?

Thanks

Howdy,

Can you paste in the error(s) that you see in $HOME/logs/error_log at the time the 500 errors occur?

-Eric

It looks like

[Tue Sep 09 12:36:09 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds
[Tue Sep 09 12:36:09 2014] [error] [client 96.233.206.91] Premature end of script headers: index.php
[Tue Sep 09 12:38:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:38:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:39:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:39:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:41:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:41:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:42:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:42:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:43:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:43:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:45:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:45:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:46:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:46:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:48:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:48:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:50:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:50:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:52:25 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:52:25 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:54:26 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:54:26 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:56:26 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:56:26 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:58:29 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 12:58:29 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:00:26 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:00:26 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:11:43 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:11:43 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:11:53 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:11:53 2014] [error] [client 96.233.206.91] Premature end of script headers: edit.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:12:45 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:12:45 2014] [error] [client 96.233.206.91] Premature end of script headers: edit.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php
[Tue Sep 09 13:12:49 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds
[Tue Sep 09 13:12:49 2014] [error] [client 96.233.206.91] Premature end of script headers: index.php
[Tue Sep 09 13:14:04 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged=1&$
[Tue Sep 09 13:14:04 2014] [error] [client 96.233.206.91] Premature end of script headers: plugins.php, referer: http://pediatricswestchester.com/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged$

Thanks

I found that article kind of related to my issue. I will test other settings for maximum PHP script run time to find out right value.

Thanks

I found that article kind of related to my issue http://blog.evilcoder.net/mod_fcgid-read-data-timeout-in-31-seconds/ . I will test other settings for maximum PHP script run time to find out right value.

Thanks

Howdy,

Hmm, my suspicion is that you may have a misbehaving WordPress plugin.

You may want to try disabling/removing plugins that you have installed, and after each one, do some testing to see if that resolves the problem.

-Eric

I have increased execution time to 60 sec but log still shows

[Tue Sep 09 14:03:00 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/
[Tue Sep 09 14:03:00 2014] [error] [client 96.233.206.91] Premature end of script headers: index.php, referer: http://pediatricswestchester.com/
[Tue Sep 09 14:04:17 2014] [warn] [client 96.233.206.91] mod_fcgid: read data timeout in 31 seconds, referer: http://pediatricswestchester.com/wp-admin/index.php
[Tue Sep 09 14:04:17 2014] [error] [client 96.233.206.91] Premature end of script headers: admin-ajax.php, referer: http://pediatricswestchester.com/wp-admin/index.php

there are a few places this might be set. if im not mistaken, you might want to setting it where ever you can find in virtualmin…

but also check the domains configuration under /etc/apache2, or whereever your domains are configured. look for either a variable which is obvious, or something along the lines of “IPCCommTimeout”

another place you might need to check, but i might be mistaken, is the fcgi wrapper execution scripts.

so check the scripts under /home/$USER/fcgi-bin or something similar

finally, double check the variables “max_execution_time” or “max_input_time” within the user defined php.ini file. likely under /home/$USER/etc/php5/php.ini

and once you are sure there are no conflicting settings, reset apache, and try again.

while testing, you might want to set it to something higher than 60.

and i’m fairly certain what eric was getting at was that maybe a plugin is spinning in the background and causing the page to continue processing even though the website has been rendered. this will end up with your server complaining like this, for certain.

good luck

I struggled a lot for such errors in platform, and the only thing that at last gave me the appropriate solution was the following one
As i deployed a clean Webmin/Virtualmin, eg MySQL imports hanged within 40-60 seconds.
Then i came across some posts and found the solution as below:
Server Configuration > Website Options, and set “Maximum PHP script run time” from 40 seconds to “Unlimited”. (maybe risky)
Issue resolved.