Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Intermittent Internal Server Errors WordPress

  • SOLVED

I am sporadically seeing internal server errors for this website: http://keysouth.com

I inquired with our hosting provider and here is how they responded:

There's issue with Virtual Memory on this account which is causing intermediate 500 error message.

On reviewing the resources usage for last 5 days I see it is on higher side :

Apr 18 2015:
keysouth keysouth.com 8.17 0.78 0.7
Top Process %CPU 59.0 /usr/bin/php /home/keysouth/public_html/index.php
Top Process %CPU 46.0 /usr/bin/php /home/keysouth/public_html/wp-cron.php
Top Process %CPU 45.0 [php]

Apr 19 2015:
keysouth keysouth.com 3.38 1.35 0.6
Top Process %CPU 62.0 [php]
Top Process %CPU 59.0 /usr/bin/php /home/keysouth/public_html/wp-cron.php
Top Process %CPU 57.0 /usr/bin/php /home/keysouth/public_html/index.php

Apr 20 2015:
keysouth keysouth.com 3.23 1.46 0.1
Top Process %CPU 80.0 [php]
Top Process %CPU 77.0 /usr/bin/php /home/keysouth/public_html/index.php
Top Process %CPU 68.0 /usr/bin/php /home/keysouth/public_html/wp-admin/upload.php

Apr 21 2015:
keysouth keysouth.com 2.18 1.52 0.1
Top Process %CPU 52.0 /usr/bin/php /home/keysouth/public_html/index.php
Top Process %CPU 47.0 /usr/bin/php /home/keysouth/public_html/index.php
Top Process %CPU 43.0 /usr/bin/php /home/keysouth/public_html/index.php

Apr 22 2015 (partial stats, 07 hours into the day):
keysouth keysouth.com 0.94 1.50 0.0
Top Process %CPU 39.0 /usr/bin/php /home/keysouth/public_html/index.php
Top Process %CPU 36.5 /usr/bin/php /home/keysouth/public_html/wp-admin/index.php
Top Process %CPU 2.3 httpd [keysouth.com] [/rental/359-timber-ridge/]

You need to have your developer to review the WordPress script and try to optimize it. Further please have them to uninstall/remove unwanted plugins/extensions in order to reduce the resources usage. Thanks!

-------------
The developer has been unresponsive and I'm not sure what I need to change or fix.

Answers (6)

2015-04-23

Jayaram Y answers:

Hi,

Give this in your wp-config.php file
define('WP_MEMORY_LIMIT', '256M');


Also once done, change the permalinks to default and then back to post name.


Anne Shenton comments:

I don't think I can change the memory limit as they are set by the host and can't be altered.


Jayaram Y comments:

You can define that in wp-config.php file


Anne Shenton comments:

OK. I don't see anything like that in the wp-config file. Can you tell me where I should insert that line of code?


Jayaram Y comments:

you can find wp-config.php file in your wordpress root folder..

open that and search for the below code

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');


you can place memory code just below the line. see example below.
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
define('WP_MEMORY_LIMIT', '256M');


Anne Shenton comments:

I did this. I was able to click around for a couple of minutes without any errors, but then logged out and back into Wordpress and got another error.


Anne Shenton comments:

And now my virtual memory limit has spiked from 833/1024 to 963/1024


Jayaram Y comments:

what error?

I am browsing your website without any issues.. Clear your browser cache and check. Also if you have installed any cache plugin, clear that as wel


Jayaram Y comments:

then you need to ask your host to increase your server ram.


Anne Shenton comments:

I did. I'm still getting errors.

I have asked host to increase RAM and they will not do it. I am in the process of migrating to a new host but that will take a couple of days and I'm trying to get this issue resolved ASAP as the client is pretty upset.


Anne Shenton comments:

I'm still getting Internal Server Errors. They are intermittent.

2015-04-23

Glenn Tate answers:

Install this plugin and it will show how much memory the site is using. I think its a hosting issue and they are just making excuses.

https://wordpress.org/plugins/wp-memory-usage/



Then install this plugin.

https://wordpress.org/plugins/heartbeat-control/

Why would I want to change the default heartbeat intervals
If you commonly leave your WordPress admin up for long periods of time, especially while writing or editing a post, the repeated POST requests can cause high resource usage. To avoid this, the heartbeat can be modified or even disabled to lower your server resource usage.


Anne Shenton comments:

I installed the memory plugin and here is what it said:

https://www.evernote.com/shard/s14/sh/737bca96-583b-4d7c-941b-633115c71ed7/c83ff253509826854194b518cbd61ae4

I'm about to install heartbeat control.

2015-04-23

Shoeb mirza answers:

Backup your .htaccess
Delete your present .htaccess
Create new .htaccess
Go to permalinks and save it.


Anne Shenton comments:

I tried this and still having the same issue.

2015-04-23

Monit Jadhav answers:

This is a hosting issue not WordPress problem. I see they have resolved it already, I can browse the site no server error for me.

On coding side I saw a lot of JavaScript written directly on to the page and also website is using a lot of external plugins to render the HTML. Another thing is your loops check if they are written properly like on this page

http://keysouth.idxco.com/idx/18955/featured.php

many images are not loading for me. Page is slow to load, so that is can be taking its toll on the server as well because of too many HTTP requests. The featured page has 85 requests some of the assets dont exist but server is trying hard to get them also causing a long server response time.

Better optimize this site before the problem occurs again.

Regards

Monit


Anne Shenton comments:

On this specific example you give, that page is not a part of the Wordpress site nor is it hosted with the same server as the rest of the site. This is a real estate website. Most of the static pages and blog are built in Wordpress, then we use a service to display the listings from their real estate listing service but skinned to look like the rest of the website. The IDX service hosts this section separately so there shouldn't be any Internal Server Errors in that side at all.

2015-04-23

Mike Van Winkle answers:

You might also install the [[LINK href="https://wordpress.org/plugins/p3-profiler/"]]p3 performance profile plugin[[/LINK]]. It will tell you which of your plugins might be eating all the memory. Also, is the problem happening on every page or just some pages. Finally you might want to look at your cron jobs with something like this [[LINK href="https://wordpress.org/plugins/advanced-cron-manager/"]]https://wordpress.org/plugins/advanced-cron-manager/[[/LINK]]. Some plugins add expensive cron jobs like vaultpress and wordfence.

2015-04-23

Dbranes answers:

There's something strange with your 404 response.

These errors are on the frontpage:

The specified value 'Your Email' is not a valid email address.
(index):328 GET http://www.keysouth.com/wp-content/themes/wordpress-bootstrap/images/name.png 500 (Internal Server Error)
(index):328 GET http://www.keysouth.com/wp-content/themes/wordpress-bootstrap/images/email.png 404 (Not Found)


So each time you load the frontpage, you are calling

http://www.keysouth.com/wp-content/themes/wordpress-bootstrap/images/name.png


but this is fetching lots of posts!

Similar happens when you load:

http://www.keysouth.com/wp-content/plugins/wp-listings/includes/css/wp-listings-widgets.css?ver=4.0.1
http://www.keysouth.com/wp-content/plugins/share-social/assets/css/modal_core.css?ver=1.0.0


and this page (for example):

http://keysouth.idxco.com/idx/18955/featured.php


contains many calls to static files that returns 500 and each one of those calls are loading the same page with many posts. So this could be heavy for your site and memory usage.

Same happens for any non-existing files under:


/wp-content/plugins/...
/wp-content/themes/...
/wp-content/uploads/...
...


You could try to let the webserver handle the 404, not WordPress.


Dbranes comments:

I see that the site is no longer returning 500 responses on 404 and that the webserver is now handling it, instead of WordPress.

I guess the site's performance is much better, after the latest webserver config update.

ps: But for the future you still need to clean up all the 404 cases on the site.

And of course find the reason for those strange 404 redirection, either in WordPress or in the webserver's config