This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How to Fix “500 Internal Server Error” in WordPress

Updated on December 21, 2021

6 Min Read
http error 500 wordpress

WordPress is not an exception when it comes to errors. It can range from your WordPress hosting to bugs in your theme or plugins. Some errors can be fixed by tweaking a thing or two, while others can take days of troubleshooting to get fixed. All this can affect your website traffic growth and user experience.

Let’s assume that your website is working fine until a minor glitch took place a few days back and you didn’t notice. Suddenly, you come across “500 Internal Server Error” on every page of your website. Don’t worry! Due to the nature and diversity of the CMS itself, you can find a solution for everything.

In this article, I’ll tell you how to fix “500 Internal Server Error” in WordPress, so you don’t have to face this issue next time, and even if you do, you have a ready solution at hand.

What Is “500 Internal Server Error”?

500 error occurs on the server level when the server cannot show the requested page. An internal server error is an application-side issue that can occur on your web server. When you write a specific URL into the address bar or if you click a link on a website, you are requesting the server to show you a page. For some reason, the server cannot show you that specific page you are looking for, which means you are facing an internal server error, as shown below.

example of 500 internal server error

– Example of Internal Server Error

Create a WordPress Backup

Most of the time, you are not responsible for the errors that occur on your hosted server. Some of these errors are severe and may compromise your website security; therefore, backing up website data on your server is highly recommended.

However, if your hosting provider fails to provide you with the right options to back up WordPress, you can try the best WordPress backup plugins.

Are you tired of fixing WordPress errors?

Try Cloudways managed hosting for a hassle-free experience.

Fix “500 Internal Server Error” in WordPress

Troubleshooting any error can save a lot of time and effort. Initial analysis of the problem can help you identify the root cause, hence paving a way to fix the problem. Many reasons can cause the server to raise a 500 Internal Server Error in WordPress. The two common causes of this error are corrupt .htaccess file and PHP memory limit. Let’s see how you can fix them.

  1. Fix .htaccess File Error
  2. Increase PHP Memory Limit
  3. Plugins Audit

1. Fix .htaccess File Error

One of the key files in any PHP-based application is the .htaccess file. This file contains server-related configuration rules. If your .htaccess file is corrupted, this can cause a 500 Internal Server Error. The .htaccess file is usually affected by a module or a broken installation of a theme. In this case, you should first access your .htaccess file.

Log in to your FTP account, and you will see a .htaccess file available in the root directory along with other folders such as wp-content, wp-include and wp-admin.

htaccess in root directory

– .htacess File in WordPress Root Directory

Now that you have located your .htaccess file, you can download it from the live server to a local location on your PC. Next, open this file in your text editor, such as Sublime Text 3, Notepad++, Dreamweaver, etc.

Go to .htaccess on WordPress.org → copy and paste the version of the code that fits best for your website → save the .htaccess file and upload it to your webserver.

The code differs for different WordPress configurations and installations. Suppose you have used WordPress Multisite in WordPress 3.5 or later, then you need to use the following code:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

Now, reload your website to see if the 500 Internal Server Error is fixed or not. If not, navigate to the next step.

2. Increase PHP Workers or Memory Limit

When a user makes a request, PHP handles it and triggers a process that ultimately renders the HTML at the client’s end. PHP memory is allocated to run this process.

Another way of fixing the 500 Internal Server Error is by increasing the PHP Memory Limit. By default, your host and WordPress set the PHP memory limit. When you notice a memory drop, the server automatically displays a 500 Internal Server Error.

To avoid such discrepancies, simply increase the PHP memory limit in WordPress and check whether your website works fine or not. This way, you can simply fix 500 Internal Server Error in WordPress.

When PHP workers are already busy on a site, they start to build up a queue. Once you’ve reached your limit of PHP workers, the queue starts to push out older requests which could result in 500 errors or incomplete requests. Read our in-depth article about PHP workers.

Some of the most common ways of increasing a WordPress website’s PHP memory limits is by altering the code in one of the following files:

  1. Functions File
  2. .htaccess File
  3. WP-Config File
  4. PHP.ini File

2.1. Functions File

Go to your root directory, find the functions.php file, right-click on it, and select Download. Open the functions.php file in your text editor and add the following code at the opening PHP tag:

@ini_set(‘upload_max_size’ , ’64M’);
@ini_set(‘post_max_size’, ’64M’);
@ini_set(‘max_execution_time’, ‘300’);

2.2. .htaccess File

Go to your root directory, find the .htaccess file, right-click on it, and select Download. Open the .htaccess file in your text editor and add the following code at the tag below PHP:

php_value upload_max_filesize 64M
php_value post_max_size 64M

2.3. WP-Config File

Go to your root directory, find the wp-config.php file, right-click on it and select Download. Open the wp-config.php file in your text editor and add the following code at the opening PHP tag:

define(‘WP_MEMORY_LIMIT’, ’64M’);
ini_set(‘post_max_size’, ’64M’);
ini_set(‘upload_max_filesize’, ’64M’);

2.4. PHP.ini File

You need to create a php.ini file and paste the following code into it. In the next step, upload the following code in the wp-admin/ directory.

memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
file_uploads = On

If these two possible ways aren’t enough to resolve the 500 Internal Server Error, here are a few more ways to avoid this server error in WordPress.

3. Plugins Audit

Faulty or outdated plugins can cause compatibility issues, leading to errors in your WordPress website. If not updated with the latest WordPress security patches, they are considered a security risk.

Go to your WordPress dashboard, deactivate each plugin one by one, and refresh your website.

deactivate wordpress plugins

– Deactivate WordPress Plugins

The internal server error must occur if your website doesn’t work properly due to a malfunctioning plugin. Activate each plugin one by one and refresh your website after each plugin activation. The problematic plugin will soon be identified.

You may either remove this plugin and replace it with an updated plugin or contact their support team to release its patch so it can be used. Ideally, at this point, the issue has been settled. If not, move to the following step.

Fresh wp-admin and wp-includes

Sometimes it is more difficult than one expected to resolve an error. Typical WordPress consists of third-party themes and plugins, and auditing their source code is no walk in the park.

In this section, you need to download new wp-admin and wp-content folders and upload them to live host via FTP.  Please make sure that you have backed up the website before this step.

Contact Your Hosting Provider

If the problem persists even after the investigation of these common causes, then it is advised that you should contact your hosting provider. You can place a request to the technical experts who can resolve your issue by going over your server settings.

You can find multiple error messages related to the 500 Internal Server Error message as they are all server-side errors. Such an example of a 500 error is the 502 Bad Gateway Error.

If you are a Cloudways user and have to face these above errors, you need to contact our Support Team. They will guide how you can resolve these issues.

Q1. What causes a 500 error?

The 500 (Internal Server Error 500) error code message is commonly associated with a Web server crash problem. This error message does not necessarily mean that the web host is responsible. The causes of one such failure are multiple.

The web server’s HTTP header information indicates to the client that something is not working normally without detailing the exact cause of the failure.

Q2. What is a 500 error?

A 500 error is an internal server error. This error may be due to a script error or misconfiguration of your web hosting. It is not necessarily the hosting is responsible, but surely, in any case, this error can be resolved by you.

Summary

I hope you find this guide helpful and that you were able to solve your “500 Internal Server Error” in WordPress. Have you figured out any other way to get rid of this problem? Please share your solutions with us in the comment section below. I am sure it will be beneficial for others who are facing similar issues.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Beautifully optimized hosting for WordPress and Magento”

Arda Burak [Agency Owner]

Saud Razzak

Saud is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform. Saud is responsible for creating buzz, spread knowledge, and educate the people about WordPress in the Community around the globe. In his free time, he likes to play cricket and learn new things on the Internet. You can email him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!