• Hi,

    I am using a shared host which is optimised for WordPress. I have configured caching with W3TC and it works. Loading time is under 2-3 seconds.

    List of my plugins: https://i.imgur.com/N9LEDBC.png

    However my memory allocation, according to my host is getting high and it has caused a few 500 internal server errors. Apparently I might need a VPS but I get around 100 visits a day which should be manageable on shared hosting right?

    The site is https://www.depressionforteens.com

    I do have quite a lot of custom code (functions.php code and I also implemented JSON-LD in the header.php of my child-theme.)

    Is there anything else I can do to keep the site going strong on shared hosting?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The first thing I would try is upping the memory limits for BOTH WP and PHP.

    For WP you would put it in your wp-config.php file, add one line:

    define('WP_MEMORY_LIMIT', '512M');

    I usually put it just below the define WP-DEBUG statement.

    I have a site that gets a lot of traffic, so I set mine at 512M (note that it’s “M” NOT “MB”). But you can try lower numbers (I think the default for WP is 32 or 64M) and go up until the problem stops. Only increase it again down the road if the problem crops up again.

    For PHP, you create a plain-text file named php.ini, and in it put this line, save it, then upload it to the /wp-admin folder:

    memory=512MB

    Again, you can play around with lower numbers and go up if needed, I usually have both files use the same number. NOTE that if you update WP, you may have to re-upload this file!! Depending on how you update, the whole folder may get overwritten so keep an eye on this.

    In every case that I’ve had 500 errors, taking these two steps has fixed it.

    Good luck!

    Thread Starter shivampaw

    (@shivampaw)

    Hi,

    I already tried to define('WP_MEMORY_LIMIT','512M');

    For the php.ini
    Will it be loaded if it’s in the /wp-admin directory?

    Also I checked phpinfo and it said it is currently set to 512M

    Hmmmm…..first off, 100 visits a day is great, but it’s a very low number that is VERY managable on shared hosting – your hosting should be able to handle 100 times that number before you need to consider VPS, *unless* those 100 visitors are also downloading huge files or streaming long videos.

    And yes, php.ini does get loaded if it’s in the /wp-admin directory. When you do an auto-upgrade, it shouldn’t get overwritten, but if you manually update WP by uploading (via FTP) the new version, then you may overwrite that file and need to re-upload it to the (new) /wp-admin folder. It’s always a good idea to double-check that it’s there after any update to WP.

    SO if you have your wp-config.sys set to increase the wp memory limit to 512M and your PHP says it’s already set to 512MB…which is really unusual for shared web hosting – it’s generally a much smaller number as their default – any settings in php.ini will override the default settings that the hosting company uses…anyway 512 should be more than enough to resolve any 500 errors.

    Hopefully someone with more knowledge of servers will chime in to help, they will likely need to know more about your hosting environment (e.g. windows vs. linux, apache I assume? and maybe what hosting company).

    You could try calling your hosting company for more assistance, but if they try to steer you into the more costly VPS, you might want to shop around. I use 1&1 and have been happy with them for many years – primarily because I *don’t* need a lot of support from them, just reliable service, but their support has improved a bit over the years.

    Lastly, a quick Google search on fixing 500 internal server errors turns up a number of pages with different solutions offered, most having to do with memory but some imply that a corrupt .htaccess file could be to blame…have a read through these to see if they help:

    https://www.elegantthemes.com/blog/tips-tricks/how-to-fix-the-500-internal-server-error-on-your-wordpress-website

    https://www.wpbeginner.com/wp-tutorials/how-to-fix-the-internal-server-error-in-wordpress/

    If you are also annoying with this Error Http 500 internal server error code problem then you have to surely read this post fully. Today here I am going to solve your ‘HTTP 500 Internal Server Error‘ code problem by using our simple easy tricks and methods.

    “Error code 500 server error” or ‘500 Error code HTTP 500 Internal Server Error‘ is basically an error code problem which is found when by the web server which is running your website encountered an unexpected condition (problem) that is preventing it from fulfilling the request by your web browser for accessing the requested URL website.
    This HTTP 500 Internal Server Error can be resolved by fixes the web server software.

    How to Fix HTTP 500 Internal Server Error Code Problem:-

    So for that problem, here are some simple methods and tips to Fix for How to Fix HTTP 500 Internal Server Error code problem.

    1. Troubleshoot as an HTTP 504 Gateway Timeout Error –
    2. Clear your Google Chrome Browser Caches –
    3. Reload or Re….. Check out more at; [Link redacted]

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @rs372433, Please don’t half-finish answers and ask people to continue reading at your website. If you must post a link to a resource, I recommend you post to the WordPress Codex resources.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘High Memory Allocation’ is closed to new replies.