Internal Wordpress server error random 500
By accident I keep getting 500 internal server errors and I checked the server log, only the errors displayed are:
End of script output before headers: admin-ajax.php
End of script output before headers: index.php
I have increased the php memory limit and wordpress memory limit to 256m. I have a woocommerce store running. When I update a heavy page resource multiple times, this is most likely when the error appears. The error also randomly goes away after about 5 minutes. I can still access wordpress readme.html
. I renamed the plugins folder and it still remains.
Any idea what might be causing this?
source to share
I would like to add this as a comment, but unfortunately I don't have enough points.
This may be due to some plugin connections with HTTP headers. Have you installed some plugin / theme before the errors start?
Can you enable WP_DEBUG to see if you can catch something there, as it is sometimes more useful than server logs.
To do this, open
wp-config.php
located in the directory where WordPress is installed and then find the line with the code
define('WP_DEBUG', false);
and change it to
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
This will keep the log in the debug.log file and is in yours
wp-content
. This is an important step to set it to a file if you don't want the site to contain errors.
You can also refer to this codex page .
source to share
Considering your comment below (mysql server is gone) and a random 500 server error (apache / http), the server might be under heavy load. It may receive more connections than it can handle until apache or mysql can respond. I would check with the web hosting provider to check if the problem is with the server or your site.
I ran into plugins with memory leaks and all the problems. If this is really something with your site, I would try disabling all plugins to make sure that fixes the problem, then re-enabling them one at a time in an attempt to reproduce the problem.
So, if you limit it to a single plugin - check (and install) updates (after getting a backup), seek support from the plugin author, look for an alternative plugin, hire a developer, or just go without it.
With wordpress, there is a possibility that the php version you are using may be wrong. Modern Wordpress installations need 5.4 or higher, especially when using jetpack. I got the issue described by the OP running wordpress 4.8.1 with Jetpack configured and connected to my wordpress.com account when my server was using php version 5.3. I switched versions to 5.4 and the problem was resolved immediately.
Hope this helps.
source to share