How to Fix 500 Internal Server Error in WordPress (Possible Tips)

Ninetheme

Getting 500 internal server errors where your website should be is enough to panic anyone. When your website crashes, you lose potential traffic and sales. If it goes offline for a while, it can also negatively impact your Search Engine Optimization (SEO) efforts.

Don’t worry, there are many ways to fix this error. Most of these solutions are pretty simple and you don’t need a lot of technical knowledge to start troubleshooting.

In this article, we’ll cover what the 500 internal server error in WordPress is and discuss some possible causes. Next, we’ll give you some tips to help you get your website up and running.

Hint: You can watch the tutorial video at the bottom of the article.

What is the 500 internal server error that is making everyone panic?

Internal Server Error

The 500 internal server error is frustratingly non-specific. When the error occurs, you usually don’t get a lot of details about it. To be honest, you may not get any information.

Also internal server error is not specific to WordPress. It can happen on any website running on a web server. Due to the general nature of this error, it doesn’t tell the developer anything.

Finally, if you see this error on your site, you will want to fix it as soon as possible. The 500 error can affect your SEO if allowed to linger. If your site is crawled offline, there is a possibility that Google may interpret the error as an issue with your website.

Continue with the article to learn ways to fix this error.

How to fix 500 internal server error?

Now that you have an idea of 500 internal server errors, it’s time to discuss how to resolve it. Let’s take a look at ten tips you can use to fix this problem in WordPress. 

Important Warning: Make sure to back up your site before starting all these possible solution tips. Let’s briefly explain how to make a backup.

How to back up the site?

it’s always smart to make a backup of your website. To make a complete backup, you’ll need to save copies of your WordPress files as well as your databases. You can back up your site’s files using a Secure File Transfer Protocol (SFTP) client such as FileZilla.

After connecting to your server, navigate to the WordPress files you want to save. These files contain the WordPress core installation, plugins, themes, images, and more. To save the files, right-click on them and select Download.

Filezilla

Now you will need to backup your database, which you can do by logging into phpMyAdmin. Select the database you want to download from the left panel, and then click the Export tab.

Next, you have to choose between “Quick” or “Custom” export. Quick export will probably work just fine unless you need to manage more advanced options.

Click the Go button and your download should begin. Once your website is safely backed up, you can start fixing this 500 error.

Possible Solutions

1. Reload Your Page

Let’s start with the best simple solution. Some conditions that cause 500 internal errors will correct themselves within a few minutes. For example, you might see a server error if you’ve made new changes to a plugin or theme, or if your host is experiencing unusually heavy traffic. If that’s true in your case, you’re in luck, because a simple page reload should get things back to normal.

Therefore, the first thing to try is to wait a minute or two for the error to hopefully resolve itself. Then you can try to reload the page by pressing F5 or (command + R if using a Mac).

2. Clear browser cache

Another quick and easy way is to clear your browser cache. Cache corruption can cause problems when trying to access websites.

First, you can tick For Everyone or Just Me. This will determine if it’s a common problem or if you’re the only one experiencing difficulties.

If you are the only one getting the 500 error, the problem may be your browser. Try accessing your site from a different browser. If an alternative works, it’s a sign that the problem is with your cache.

You can clear your cache by pressing Ctrl + Shift + Delete in Google Chrome. Alternatively, you can click the three vertical dots in the upper right corner and then click More tools > Clear browsing data.

Make sure you check the Cached images and files box. Then click the Clear data button.

You can clear the cache using the Ctrl + Shift + Delete keyboard shortcut in Firefox. This will open the Clear Recent History window. Select Everything in the time range to clear drop-down menu. Check the cache box and then click OK.

In Safari you can go to the History menu item and select Clear History. Note that this will delete everything including cookies and pages visited.

3. Checking for Corrupt .htaccess File

The first thing you should do when troubleshooting internal server error in WordPress is to check the corrupted .htaccess file.

You can do this by renaming your main file. htaccess file to something like .htaccess_old. To rename the .htaccess file, you need to login to your site using FTP or File Manager app in your hosting account’s cPanel dashboard.

Once connected, the .htaccess file will be located in the same directory where you will see folders like wp-content, wp-admin and wp-includes.

Rename-htaccess-backup-file

After renaming the .htaccess file, try visiting your site to see if that fixes the problem. If so, sit back as you fixed the internal server error.

Before proceeding to other actions, make sure you go to the Settings » Permalinks page in the WordPress admin area and click the save button without making any changes. This will create a new .htaccess file with proper rewrite rules to ensure your post pages don’t return 404 errors.

If checking for the corrupted .htaccess file solution didn’t work for you, you need to continue reading this article.

4. Increase your PHP memory limit.

Another reason you might see the 500 internal server error is because you have exceeded your server’s PHP memory limit. There are several ways to increase your limit, and they all involve using SFTP.

Before you try increasing your memory limit, you might want to start by seeing what it’s currently set to. You can do this via the WordPress admin dashboard. Note that with some variations of the 500 error you will not be able to access the dashboard. In this case, you may need to skip this step.

From your WordPress dashboard, go to Tools > Site Health. Click Info at the top of the screen and go to the Server section. There you should see your PHP memory limit.

There are several files you can edit to increase the PHP memory limit. One of them is your .htaccess file, which is usually located in the root of your site. Open the file and add the following code:

php_value memory_limit xxxM
You can replace “xxx” with the amount of memory you want. Usually, 256M is enough.

You can also increase your memory limit by editing your php.ini file. You should be able to find this file in your root directory. If not, you can go ahead and create one. Add or update its code to the following:

memory_limit = xxxM
Another option is to add the following code at the top of your wp-config.php file:

define(‘WP_MEMORY_LIMIT’, ‘xxxM’);
If this resolves the 500 error, your next task will be to find out what caused the memory limit to run out. It could be a problematic plugin or theme. You may want to consider reaching out to your host for help finding exact server diagnostics.

5. Deactivate all Plugins

If none of the above solutions worked for you, this error is most likely caused by a specific plugin. It’s also possible that it’s a combination of add-ons that don’t play well with each other.

Unfortunately, there is no easy way to find it. You need to disable all WordPress plugins at once.

If disabling all plugins fixed the error, you know it was one of the plugins causing the error.

Simply go to the WordPress admin area and click ‘Plugins’. Now you have to re-enable one plugin at a time until you find the plugin causing the problem. Get rid of this plugin and report the bug to the plugin author.

6. Look for coding or syntax errors in your CGI/Perl script.

If you’re running Common Gateway Interface (CGI) scripts, coding errors you make can result in a 500 error. Log into your site using Secure Shell Access (SSH) to uncover potential issues with your CGI scripts.

After logging in, you can troubleshoot your CGI with this command:

[server]$ ./cgi_name.cgi
The terminal should return a generic error message and the line number where the culprit was found. From there you can work your coding magic!

When working with CGI, there are a few best practices to keep in mind to avoid problems. First, it’s wise to use a plain text editor to make sure you keep the ASCII format. When you upload the scripts you should also be able to select ASCII mode in your FTP client.

Finally, if necessary, upload it to the cgi-bin directory on your server. Then you can double-check the permissions of your files after installing.

7. Re-uploading Core Files

If the plugin option didn’t fix the internal server error, it’s worth reinstalling the wp-admin and wp-includes folder from a fresh WordPress installation.

This will NOT delete any of your information, but it may fix the problem if any file gets corrupted.

First you will need to visit the WordPress.org website and click on the Download button.

wordpress.org-homepage

This will install the WordPress zip file on your computer. You need to extract the zip file and inside you will find a wordpress folder.

Next, you need to connect to your WordPress website using an FTP client. Once connected, go to the root folder of your website. It is the folder that contains the wp-admin, wp-includes, wp-content folders.

In the left column, open the WordPress folder on your computer. Now you need to select the wp-include and wp-admin folders and then right click and select ‘Install’.

uploadfreshwpfiles

Your FTP client will now transfer this folder to your server. It will ask if you want to overwrite the files. Select ‘Overwrite’ and then ‘Always use this action’.

target file already exists

Your FTP client will now replace your old WordPress files with newer copies. If your WordPress files are corrupt, this step will fix the internal server error for you.

8. Check for the ‘Error Establishing a Database Connection.’

If there was a problem establishing a database connection, your site will not only be offline for visitors, but you will also not be able to access the WordPress admin dashboard. There are several possible reasons for this:

-Incorrect database login credentials

-A corrupt WordPress database

-A corrupt WordPress installation file

Let’s start with incorrect login credentials as this is a common cause of database connection failure.

Go to MySQL Databases and find the one corresponding to your website under Databases in this server section. Here you will find your database name under the Database header. The username is listed under the User Access column.

Click on the username to find the password. On the next screen, scroll down and click the Show button next to the password field.

Next, you will compare these credentials with those in your wp-config.php file. You can access this file in the main directory of your site via SFTP. After downloading the file, open it and verify that the information under MySQL Settings matches the information you found in your panel.

Then, if your database gets corrupted, you can quickly repair it via phpMyAdmin. Login and click on your database on the left panel. Select all tables in the database and then select Repair table from the drop-down menu.

repair database

Finally, let’s look at how to handle a corrupt WordPress installation file. Start by downloading a fresh copy of WordPress and opening the file. You will need to delete the wp-content folder and the wp-config-sample.php file.

Upload the remaining files to your site via SFTP and overwrite any existing ones. You now have a brand new, pristine WordPress installation. You will also want to clear your browser’s cache before checking your website again.

9. Check for permission errors

If any of your files have permissions set incorrectly, you may see 500 internal server errors as a result. Again, you can check and change these permissions using SFTP.

Right click on any file and select File permissions to open a new dialog. In this window you can check the file and set new permissions for the file if necessary.

permissons

You can set files to “644” and directories and executables to “755”. However, if you do not know the exact values, you may want to consult your server.

10. Contact Your Hosting Provider

If all the methods shown fail to fix the internal server error on your website, it’s time to get some more help. Contact your web hosting support team immediately and they will be able to check the server logs and find the root cause of the error. We hope this article was useful for you. If it was helpful, please let us know by leaving a comment.

Also, if you want to switch to a new hosting, you can click on the gif below to switch to the appropriate one for you.

Video Tutorial

Play Video

If you have any questions about this article or other topics, please click the button below. Your questions will be answered soon.

If you want an affordable, reliable and fast WordPress server, just go ahead and click on the button and get a package as needed.