WordPress: How to Fix the HTTP ERROR 500

If your WordPress website is hosted under a shared hosting account then chances are you have already bumped into the dreadful White Screen of Death. Sometimes you may also notice an “HTTP ERROR 500” warning too. Either way, your site is not reachable for you or your visitors. Most of the times you won’t be able to access the WordPress Dashboard too so it is not much you can really do apart from contacting your hosting provider support.

In this guide, we’re going to help understand where HTTP ERROR 500 comes from and how to fix it using a client case. If you feel comfortable accessing your WordPress wp-config.php file through cPanel’s File Manager or using an FTP client then it won’t take more than 3-4 minutes to fix the White Screen of Death.

This warning is actually a message to the website owner saying that the memory needed to run this site is actually more than the one your hosting provider allows. In the following steps, we’ll show you how to verify the source of this issue and how to fix it.

Find the source of the 500 HTTP error

The HTTP ERROR 500 warning is a very general one and can mean a lot of things. The fastest and most secure way to find the source of this warning is to enable PHP Error Displaying through the php.ini file.
So you need to browse to your WordPress installation directory and sreach for a file under the name of php.ini. If it’s not present then you need to create it yourself. Then edit it and add the following rule:

display_errors = On

Finally, save it and reload your WordPress site. In our client’s site the page refresh revealed the following warning:

Thu Dec 11 00:11:54 2018] [error] [client xx.xxx.xxx.xx] FastCGI: server “/var/xx/xxx-php70.fcgi” stderr: PHP message: PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 32768 bytes) in /xxx/home/xxx/xxx.com/html/wp-content/plugins/woocommerce/includes/log-handlers/class-wc-log-handler-file.php on line 1

This meant that our client hosting provider didn’t allow their WordPress site to use more than 42MB of memory.

Increase your WordPress site memory limits

So the next step was to try and increase that memory limit using one of the following 3 ways:

1. Edit the wp-config.php file

The safest way to increase your WordPress memory limit is to access and edit its wp-config.php file by adding the following directive:

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

This orders the server to assign more memory to your WordPress application up to 64MB. Once you add the rule save the file and reload your WordPress site.

2. Add or Edit the php.ini file

If the 1st option doesn’t solve the memory exhausted issue we suggest to create or edit, if it’s already present, a file called php.ini. Then add the following rule and save it.

memory_limit = 64M

Finally, reload your website and see if it works.

3. Increase your site memory limit through the .htaccess file

.htaccess is present in Apache web servers and its a powerful and potentially dangerous way to edit how your web server works. Therefore we suggest to create a backup of the original file first and then edit it, add the following rule and save it.

php_value memory_limit 64M

Once you save your newly edited .htaccess file visit your WordPress site and reload it. If you still see the 500 error or a new one then restore your original .htaccess file.

What if none of these 3 fixes works?

If you follow all 3 options to repair the PHP Fatal error: Allowed memory size exhausted warning for your WordPress site then you may need to assign even more memory to your application so you need to ask help from your hosting provider support dep.

Can you help me fix this issue?

If you don’t feel comfortable enough trying fixing the HTTP ERROR 500 issue yourself or you’re too busy to get down and dirty you can contact us and ask for a quote.

Leave a Reply

Your email address will not be published. Required fields are marked *