Casbay Knowledge Base

Search our articles or browse by category below

How to Fix Internal Server Error on Your WordPress

Last modified: September 30, 2022
Estimated reading time: 6 min

Whenever there is an issue, the 500 internal server error is running on each page of the site. With the server or file system that’s powering your site. The most probable cause is that your WordPress files are located in the root directory. However, an issue may also be trigger on the server of your host.

This is one of WordPress ‘ most frustrating errors. It never has a simple solution; it takes a long time and patience to solve the problems. But we’ll try to help ease this. Some of this stress is by proposing a number of solutions and going through each of you.

Let’s get started.

Common Solutions for the 500 Internal Server Error

The most common reason for this error are a corrupted .htaccess file that exceeds the server’s PHP memory limit. After installing a plugin, the .htaccess file in your WordPress directory can get corrupted or make another change to your WordPress website again. The fix is straightforward. You simply need a new .htaccess file to be created.

PHP memory limit issues often occur as the result of a poorly coded plugin. Run-on your website or site, which has grown significantly over time and has too many plugins. When either of these things happens, you will start exceeding the PHP memory limits set by your hosting supplier. The outcome is a 500 internal server error.

We will learn how to build a new .htaccess to remove the corrupted one and to check if you exceed your PHP memory limits or not.

The .htaccess file in your WordPress directory can become corrupted after you install a plugin.

Creating a New .htaccess File

Open your WordPress root directory in FileZilla or your preferred FTP client. This is typically called public_html. If you see folders named wp-admin and wp-content, you’re in the right place. If you don’t see your .htaccess file or any dotfiles, make hidden files viewable by clicking Server and selecting Force Showing Hidden Files.

Find .htaccess File

Once you find your .htaccess file, right-click it, and rename it “.htaccess.bak”. This essentially deletes your site’s .htaccess file, so we need to create a new one. Go into your WordPress admin area. Hover over Settings, and select Permalinks. Scroll down to the bottom of the page, and click Save Changes.

Open your website in your browser. If the 500 internal server error is gone, it was caused by a corrupted .htaccess file and your problem is now fixed. If you’re still seeing the error, you have some more tests to run.

It’s also worth mentioning that an improperly named .htaccess file will cause this error to run on your site. Make sure this file is not named anything other than “.htaccess”.

It’s additionally worth bringing up that an improperly named .htaccess file will reason this error to run on your site. Make sure this file is not named something other than “.htaccess”.

Increasing Your PHP Memory Limit in WordPress

PHP memory limits are set by your host and WordPress. WordPress will attempt to increase your limit if you begin exceeding it, but it can only go as high as the limit your host has placed on your server. This limit is often lower for shared hosting plans. You need to increase your PHP memory limit in WordPress and refresh your site to test whether or not this is causing your 500 Internal Server Error.

Internal Server Error

Open your root directory and locate your wp-config.php file. Download to your computer by right-clicking on the file. Open the file in your preferred text editor and insert this code bit under the PHP tag:

define(‘WP_MEMORY_LIMIT’, ’64M’);
Save the file, and re-upload it to your root directory, overwriting the original file. Refresh the client, and refresh your site. If you still see the error, you are not having PHP memory limit issues. Remove the above code from the wp-config.php file on your computer, save it, and re-upload it to your root directory.

Don’t get too excited if you don’t see the error. Regardless you have some work to do.

Increasing your site’s PHP memory limit in the wp-config.php file is the equivalent of pouring bleach down your kitchen sink when it smells like rotten eggs. You’re fixing the problem well enough to get rid of the offensive odor, but you’re not fixing the bigger issue at hand, which is likely a clog somewhere in the pipes that lead to your sink.

The same is true with increasing your site’s PHP memory limit. You may have increased it yourself in the file, but something is still exhausting your limit. You can follow the steps in the next few sections to try and find out what that might be, but if worst comes to worst, you’ll likely need to convince your host to increase the limit on your server.

Less Common Solutions for the 500 Internal Server Error

Fixing a corrupted .htaccess file and increasing a site’s PHP memory limit are the top two solutions for fixing this error, if they have not helped you, there are other solutions.

They are as follows:

  • Deactivating plugins to check for faulty plugins.
  • Locating issues by debugging your site.
  • Checking if your files and folders have the correct file permissions.
  • Uploading fresh wp-content and wp-includes folders to your site.
  • Asking your host if the issue is on the server that powers your site.

Deactivating Plugins

You can deactivate your plugins one by one if you can get into the WordPress admin area. Upon each disabling, refresh your website. If the error disappears, the plugin you deactivated was probably caused before it was refreshed.

Delete the plugin and find a replacement if its function is important for your site. If you don’t feel you can replace the plugin, contact the developer directly. You can do this within the plugin’s support forum on WordPress.org, but I recommend doing a bit of research to see if the developer offers support elsewhere.

Open your FTP client if you can’t access the WordPress admin area. Open the root directory, and open the wp-content folder. This folder contains your Plugins, Themes and other folders.

Rename the Plugins folder to anything you wish, such as “plugins.test”. This deactivates all of the plugins on your site. Refresh your site. When the error is gone, it was caused by a faulty plugin. Activate each plugin one by one and refreshing your site after each activation, to see which plugin is causing the error.

Then ensure that your folder is then renamed back to “Plugins.”

Debugging Your WordPress Website

If you’re having trouble figuring out what’s causing this error to run on your site, you may want to use WordPress’ built-in debugging feature. Pasting a bit of code into your site’s wp-config.php file enables debugging on your site. Any errors find are record in a file in your directory.

Josh Pollock wrote a post on how to use this feature in WordPress a while back. If you’re a developer, go ahead and start debugging your site. If you’re an average site owner, you may want to sit this one out as you may not know the difference between a minor error that can be safely ignored and a major error that should be taken care of promptly.

Normally, debugging a live site is frowned upon as it may reveal essential code to site visitors, among other things. It may however be the only way to explain what could cause your site to run the 500 internal server error.

Checking File Permissions

This likely isn’t the issue, but it’s still worth checking. In your WordPress directory, permissions for folders and files should be 755 or 644. Setting permissions to anything else may cause problems, including 500 internal server errors.

Open your root directory in an FTP client. Many clients, including FileZilla, have a Permissions tab you can use to quickly check the permissions for each file and folder in your root directory. Make sure these are not set to anything other than 755 or 644.

Uploading Fresh Versions of wp-admin and wp-includes to Your Site

The next step is the last resort, but it’s worth trying if you use the above solutions and can’t still find one that works. Backup and download from the main website a fresh version of WordPress.

WordPress-wp-admin-wp-includes site directoryUploading Fresh Versions of wp-admin and wp-includes
Extract the files from the ZIP file, and open the extracted folder. Open your site’s root directory in an FTP client, and upload the wp-admin and wp-includes from your fresh version of WordPress to your site’s directory, overwriting the older versions.

Refresh the client, and refresh your site. If the error is gone, it was likely caused by a corrupt core file. If you still see the error, you may have no other option than to contact your host.

Contacting Your Host

When you have completed all these steps and are unable to find a solution, your host can have it. However, you need to proceed with these steps in order to ensure that your root directory does not contain the problem.

The pleasant of the support you acquire differs between hosts, however, many hosts may additionally shrug the problem off and blame your site’s files alternatively than their servers. This isn’t out of the question as third-party plugins and themes do cause plenty of issues that are out of your host’s hands.

So, it’s vital that you go thru all of these steps so you can provide an explanation for to them that you check each nook and cranny of your file system and can’t find a single issue that would lead to the 500 internal server error that’s running on your site.

Politely ask them to check their server logs to see if the issue is there.

Final Thoughts

The 500 internal server error is a frustrating issue as it doesn’t always have a clear cause or a clear solution. It requires a lot of troubleshooting, as you’ve learned, but I hope these steps have at least made the task a little less irritating.

All in all, make sure you back up your site on a regular basis and update your plugins, themes, and WordPress core files as soon as they’re available. A great way to prevent this issue is to ask your theme’s developer whether or not their theme or an update to their theme is compatible with the plugins you’re running on your site as this may corrupt your .htaccess file.

Lastly, make sure you upgrade your hosting package accordingly. This error is most likely to occur on a small-budget shared hosting server, so it’s important for you to begin researching other options so you can move your site to a server capable of handling your growing site. Feel free to check out our Shared Hosting package or learn more at this security update serendipity update guide.

Was this article helpful?
Dislike 0
Previous: Permalink in WordPress Hosting