WordPress Internal Server Error: Cause and Solutions


Published at tips tricks by Jacek Piotrowski on 04th Oct 2021

We all hate it when WordPress is throwing us errors. But, the more you tweak your website, the higher the chance you’ll inevitably run into one. Sometimes, it’s not that big of a deal – at least when it tells you what’s going on and you know what you did wrong.

But, that’s not the case with WordPress Internal Server Error. Not only it’s the most common WordPress error out there. The platform won’t even tell you why it’s showing it in the first place!

In this guide, we’re going to explore all the reasons why you may be seeing the infamous 500 error. Then, we’ll go over the potential solutions that’ll hopefully save you hours of trying to guess what’s going on.

Table of Contents:
1. WordPress Internal Server Error – What Are the Causes?
2. Before You Invest Too Much Time Into Fixing It
     The Obvious WordPress Internal Server Error "Fix"… Reload the Page
     Clear Your Browser Cache
     Clear Your CDN/Server-Side Cache
     Check If Others See WordPress Internal Server Error Too
3. Retracing Your Last Steps
4. Solving WordPress Internal Server Error If You Can Access Admin Area
     Start Deactivating Plugins
     Switch the Theme to the Default One
     Reverse Your Most Recent Coding Changes
5. Solving WordPress Internal Server Error If Admin Area Is Not Accessible
    
Fix the Corrupt .htaacess File
     Start Renaming Plugin Folders
     Deactivate the Theme
     Fix WordPress Internal Server Error By Increasing Your PHP Memory Limit
     Double-Check (and Fix) File Permission Settings
     Check for PHP Version Issues (or Other Server-Side Problems)
6. Preventing WordPress Internal Server Error in the Future
7. Start Monitoring Your Website Now

1. WordPress Internal Server Error – What Are the Causes?

As we’ve mentioned in the introduction, WordPress won’t tell you the cause of the error. In fact, the 500 error isn’t exclusive to WordPress. But, if you’re running a WP site, most of the time, the cause will have to do with your WordPress website files. The most common causes of the WordPress Internal Server error include:

  • A malfunctioning plugin or theme

This is when your plugin or theme performs an operation it shouldn’t really be doing. It may happen when either the files are corrupt or when there’s a conflict between certain plugins or themes.

  • A corrupt .htaccess file

The .htaccess is one of the most important files in your whole WordPress installation. Unfortunately, it can get damaged any time you install a plugin or make website changes.

  • Exceeded PHP memory limit

Most plugins and themes shouldn’t exceed your server’s PHP memory limit. Still, that limit is a common cause of the WordPress Internal Server Error. Usually, this happens if your limit is set surprisingly low or if a plugin or theme were coded badly. In most cases, the error will occur when you try to upload the file that’s too big for your memory limits to handle.

  • Wrong permission settings

This is an unlikely cause of the Internal Server Error, but it’s still worth keeping in mind. Sometimes, when uploading files manually, you can leave file permissions set incorrectly. If that’s the case, WordPress may have trouble accessing the files and, as a result, will throw the 500 error.

  • PHP version issues

Just like the above, it’s not a common cause of the 500 error. But, if you’re running an old PHP version on your server, it may not have a function that a new theme or plugin is requesting. As a result, the website may fail to load correctly.

2. Before You Invest Too Much Time Into Fixing It

Whether you’re a developer with years of experience under your belt or a junior website manager, you just want to do your job. And fixing errors is the inevitable part of it. Still, the less time it takes, the more time you have to develop the sites. Before you dive deep into fixing the error, let’s check if it persists due to… caching!

The Obvious WordPress Internal Server Error "Fix"… Reload the Page

Do it a few times. Try incognito mode and check 1 – 2 other browsers. Sometimes WordPress Internal Server Error will “fix itself” after a minute or two. Usually, you won’t even know why it occurred in the first place (though you may find the answer in the logs).

Clear Your Browser Cache

Now, the 500 error has nothing to do with your computer or your browser. But what if you see the error in one browser but not the other? It could be that your browser has cached the version of your site that’s throwing the error.

The first thing you can do is a hard refresh (hit CTRL + F5). This will reload the page, forcing it to load all the data again. If this won’t help, the next step is to clear your browser cache. To do that, you need to:

  • In Chrome or Brave, hit Ctrl + Shift + Del or go to More Tools > Clear Browsing Data….
Chrome drop-down menu

Then, make sure to check Cookies and other site data and Cached images and files. Note that you don’t necessarily have to clear your browsing history. For time range, you can select the past hour (if the error is fresh) or go as far as removing everything.

Clearing chrome cookies and cache to see if WordPress Internal Server Error persists
  • For Firefox, open the drop-down menu and hit Settings.
Firefox drop-down menu

Next, click Privacy & Security and scroll down to Cookies and Site Data. There, click Clear Data button:

Firefox cookies and site data menu

When the pop-up appears, make sure both Cookies and Site Data, as well as Cached Web Content are checked:

Clearing Firefox data to see if WordPress Internal Server Error persists

Clear Your CDN/Server-Side Cache

If the above didn’t work, check if you can clear your server or CDN cache (such as Cloudflare; that’s if you’re using one). If you’re not using any CDN or caching, read this WordPress CDN article to find out why you should. Of course, that’s after you fix WordPress Internal Server Error.

Check If Others See WordPress Internal Server Error Too

Lastly, let’s check if others are seeing your website the same way you do. A quick way to do that is to use a tool like Down for Everyone. Simply enter your website address to check its availability.

Checking if WordPress Internal Server Error persists using Down for Everyone

If none of the above works and the website still doesn’t load, it’s time to dive deeper into the error solutions.

3. Retracing Your Last Steps

Often, you can solve Internal Server Error by retracing the last steps you’ve taken. Start by thinking: did you activate a plugin or theme shortly before the error occurred? Or maybe you made some edits to the code of your theme or a plugin? If you believe there’s something you did that may have caused the error – congratulations. You may have just saved yourself plenty of time. Simply go ahead and reverse recent changes.  

And what if you can’t think of anything that you did that could have caused the error? In this case, simply follow the steps we share in this guide!

4. Solving WordPress Internal Server Error If You Can Access Admin Area

Just because your website doesn’t load, it doesn’t mean you won’t be able to access the WordPress dashboard. While it’s not always the case, sometimes the dashboard is still accessible. That’s why the first thing you should do is see if you can access your WP site’s admin area.

If it’s there, there are three things you can do:

Start Deactivating Plugins

First, start deactivating all the plugins. In general, there are two ways you can go about doing it. One way is to deactivate everything. If the error disappears, you then want to activate one plugin at a time, checking which plugin causes it.

You can also do the opposite and deactivate the plugins one by one. Ideally, you want to start with the most recently added or updated ones. While both should work, we don’t recommend deactivating all the plugins. Why? For example, if you’re using a security plugin that changes the address of your /wp-admin/, deactivating it may cause additional issues.

Note: Each time you deactivate a plugin, do that in a new incognito/private window. Then, do a hard refresh (Ctrl + F5) when checking your site. Once you deactivate all plugins, consider clearing server/browser cache once again too. The same rule can be applied to switching the theme.

Switch the Theme to the Default One

The next thing you can try is switching the theme to the default WordPress one. To do that, head over to Appearance > Themes. There, select the default theme from the Twenty-Twenty series:

Twenty Twenty One WordPress theme activation

If you’ve already removed it from your website (it’s recommended to do that if you’re not using it), hit Add New. Then, search for Twenty Twenty and find the latest Twenty Twenty theme. Lastly, hit Install to begin installation:

Twenty Twenty One WordPress theme installation

Should this fix the issue, you can now start thinking about the last changes you’ve made to your main theme. This takes us to the next point.

Reverse Your Most Recent Coding Changes

Did you add any new functions to your website? It could be that you added new code a while ago, but initially, everything was fine. It didn’t cause any errors until it started conflicting with an update, or some other changes to the site. The obvious solution is to comment out recent changes and reload the website after each change to see if it starts working.

5. Solving WordPress Internal Server Error If Admin Area Is Not Accessible

Fixing WordPress Internal Server Error when admin dashboard is up and running sounds easy. The thing is, most of the time you won’t be able to do that.

Fixing WordPress Internal Server Error when the dashboard is up and running is easy. The thing is, most of the time, the error will crash the whole website – including the dashboard.

In this case, you’ll need FTP access to your server. Once you get your FTP credentials, the next step is to find a tool that’ll allow you to do that. One of the most popular (and free) FTP tools is FileZilla. You can download the latest version here.

FileZilla FTP Manager download page

After you install and open FileZilla, we need to add your website to its Site Manager. To open Site Manager, click the first icon below the File Menu. Alternatively, enter your server IP, port, username and password right below the menu. Then, hit Quickconnect to access the server.

FileZilla FTP manager menu

 However, if you decide to add it to the Site Manager, you’ll be able to reconnect with just one click in the future. Once you open Site Manager, click New Site.

In, most cases, you’ll need to set the protocol on the right to SFTP. Then, add the host, port, username, and password data. Once that’s done, hit Connect. The next time you’ll want to connect to the site, you’ll find it saved in Site Manager.

Adding a new site to FileZilla FTP manager to try and fix WordPress Internal Server Error

Once you’ve established an FTP connection with your website, we can start editing the files.

Fix the Corrupt .htaccess File

The first thing to try is to check the .htaccess file. The .htaccess file is the main configuration file of your website that’s read by your server. It includes information about caching, permalinks settings, or certain permissions info. Corrupt .htaccess file is the most common cause of WordPress Internal Server Error.

Note: If your server is using Nginx instead of Apache, then your WordPress installation is not using a .htacccess file. In this case, try the other solutions listed in this article. If none of them works, reach out to your server support for help.

If you’re unsure whether your server is running on Nginx or Apache, it’s 99,9% the latter. Most of the time, if you were running Nginx, you’d know it.

With the above in mind, let’s get to fixing the .htaccess file. First, make sure that you close all instances of the website in your web browser.

Next, open FileZilla, connect to your server and open the public_html folder. Then, right-click the file and select Rename.

Renaming .htaccess file to fix WordPress Internal Server Error

Change the name of the file to something like .htaccess-currentdate.bak. The reason we want to use the .bak extension is that the server won’t recognize it. Once you rename it, clear the cache of your browser, open a private window and visit your website.

If it’s now loading correctly, this means that the issue was with the .htaccess file. In this case, head back to FileZilla. Then, right-click anywhere inside your public_html folder and hit Refresh. Interestingly, some servers might recreate the .htaccess automatically.

If that’s the case, you can start comparing the differences between the two .htaccess files. Then, you can start moving parts of the old file to the new one. If you see WordPress Internal Server Error again, you’ll know what caused it. Keep in mind that if the .htaccess doesn’t get recreated, you can do that manually following this guide.

Note: If you recreate .htaccess file and Internal Server Error disappears, log into your website immediately. Then, go to Permalinks settings and set site’s permalinks back to the way they were. If you don’t all your content will start showing 404 error.

Start Renaming Plugin Folders

If the admin dashboard is not accessible, you can’t just log in and start deactivating plugins. But you can still deactivate them by making WordPress think they’re gone. To do that, head back to the public_html folder and then over to wp-content > plugins.

Finding plugins folder using FileZilla FTP manager

Ideally, you want to deactivate the plugins starting with the most recent ones. If you can’t recall any new plugins or changes to the existing ones, just start deactivating them one by one. Simply right-click the folder name and rename it to something else.

After you rename each folder, visit your website in private mode. Remember to close any incognito windows after each check to clear browser caching.

Deactivate the Theme

If none of the plugins was causing WordPress Internal Server Error, it’s time to take the theme route. The idea is the same. You need to go to wp-contents > themes and rename the active theme folder. If you’re unsure which one that is, go ahead and rename them all.

Finding themes folder using FileZilla FTP manager

Note: Keep in mind that if you rename the theme folder, WordPress won’t load the front-end of your website. When trying this fix, you can check if your website is working by trying to access its admin panel.

Fix WordPress Internal Server Error By Increasing Your PHP Memory Limit

Next, try increasing your PHP memory limit. To do that, there are three files you can edit. Typically, it’s enough if you edit just the first one – but there’s nothing stopping you from trying all three. First, head back to the public_html folder, find the wp-config.php file, and open it in a file editor.

Editing wp-config.php file using FileZilla

Next, you need to add the following line:

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

Put the above snippet right before ‘That’s all, stop editing! Happy blogging.’ (it’s close to the bottom of the file). This will set your PHP memory limit to 256MB which is plenty for any WordPress site.

The next file you can try editing is .htaccess. Locate the file in the public_html folder and right-click to open it in a text editor:

Editing .htaccess file using FileZilla

Next, add the following line somewhere inside the file:

php_value memory_limit 256M

php_value upload_max_filesize 64M

php_value post_max_size 64M

php_value max_execution_time 300

php_value max_input_time 1000

Note that those lines may already exist inside your .htaccess file. In this case, you need to search for them and edit the numbers.

The last file you can try is php.ini. Unlike the other files, it should be in the /wp-admin/ folder. If it’s not there, go ahead and create it:

Creating a php.ini file to solve WordPress Internal Server Error

Name the file php.ini. Then, add the following code to it:

memory_limit = 256M

upload_max_filesize = 64M

post_max_size = 64M

max_execution_time = 300

Please note that you usually only need to add these to one file (so editing wp-config.php should be more than enough). Also, this is only helpful if the error occurs when uploading files to your WordPress website.

Double-Check (and Fix) File Permission Settings

The next (although unlikely) fix you can try is changing file permission settings. If you look at your WordPress files inside FileZilla, you’ll notice a Permissions column:

Reviewing file permissions column when looking for a solution to WordPress Internal Server Error

If you look at the files, all folders and all files have the same set of permissions. As a rule of thumb, all files should have their permissions set to 644 and all folders to 755. These numbers rule who can read, write, and execute the files. While we won’t go into too much detail, you can learn more about file permissions, in this Wikipedia article.

To check the number, right-click any folder and then any file. For files, you want the permissions to look like the below:

Setting 644 permissions to files of one's WordPress website

The above sums down to -rw-r--r—which you can see in FileZilla’s column. For folders, you want permissions to look like the below:

Setting 755 permissions to folders of one's WordPress website

The beauty of it is that you can bulk edit the permissions. Simply check the Recurse into subdirectories. Then, select whether you want the change to apply the changes to files, directories, or both files and directories.

Check for PHP Version Issues (or Other Server-Side Problems)

If none of the above works, the last thing you can try is check PHP version on your server. Ideally, it should be at least 7.3, as even 7.2 will stop receiving updates by the end of 2020. If you’re still on 5.X, reach out to your host and ask them to update PHP as soon as possible.

If this won’t help, reach out to support and ask them to look into it as it probably has to do with the server itself.

6. Preventing WordPress Internal Server Error in the Future

Of course, fixing the error is one thing. The last thing you want is for the error to cash your server again. While you can’t eliminate all the risks, there are a few things you can do to minimize the damage:

  • Start monitoring your site’s uptime. You can’t possibly be checking your website 24/7 – but a plugin can do that for you. WP Blazer’s uptime monitoring feature will let you know any time your site goes down. That way, you can react as soon as the site goes down, minimizing the damage.
  • Keep theme changelog. Sometimes a small theme change can crash your whole website. A theme changelog gives you an overview of all the changes to your theme. That way, you know what was changed and when. You can even turn it into a website changelog you’ll use to log all changes to your site.
  • Record website activity. It’s easy to control website changes if you’re the only person making them. But what if you have a whole team working on your website? A plugin like WP Activity Log keeps an automated log of every change that happens to your site. Whenever you encounter WordPress Internal Server Error, all you need is to review the log. Then, see which change could have caused the error and reverse it.
WordPress WP Activity Log plugin landing page
  • Use a WordPress development environment for implementing and testing changes. Most Internal Server Errors are caused by changes to the site. To keep things safe, it’s best to test any changes in a development environment first. That way, even if the change crashes your website, it won’t crash the live site.

7. Start Monitoring Your Website Now

WordPress Internal Server Error is a tricky beast. You can’t always prevent it from happening. What’s worse, when it does happen – it probably won’t tell you what caused it. Plus, sometimes things will break down and there’s little you can do about it. But, whenever an error occurs, what really matters is how fast you can react when the site goes down. The sooner you start retracing your last steps and reversing changes, the better.

The best way to speed up your reaction time and minimize the damage? Start monitoring your website with WP Blazer’s Uptime Monitoring. Visit this page to start a free 14- days trial and keep an eye on any errors occurring on your site 24/7.