Your Gateway To Digital Success
Wesbytes Blue Logo

Wesbytes Knowledge Base

Search our articles or browse by category below

How to Fix Internal Server Error on Your WordPress

Last modified: July 2, 2022
You are here:
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.

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.

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

Your host and WordPress define PHP memory constraints. If you start going over your limit, WordPress will try to increase it, but it can only do so up to the server limit set by your host. For shared hosting plans, this cap is frequently lower. To check if this is the source of your 500 Internal Server Error, you must increase the PHP memory limit in WordPress and then refresh your site.

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 taking care of the immediate issue, which is probably a clog somewhere in the pipes leading to your sink, sufficiently enough to get rid of the unpleasant stench, but you’re not taking care of the greater problem.

The same is true when you raise the PHP RAM limit for your website. Even if you increased it yourself in the file, something continues to exceed your limit. If worse comes to worst, you’ll probably need to persuade your host to raise the limit, so you can try to figure out what it might be by using the steps in the following sections.

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.

Deactivate Plugins

If you can access the WordPress admin interface, you can deactivate each plugin individually. Refresh your website after each deactivation. If the error goes away, it was probably caused by the plugin you removed before it was reloaded.

If the plugin’s function is crucial for your website, remove it and locate a replacement. Contact the plugin’s creator directly if you don’t think you can replace it. You can do this on the support forum for the plugin on WordPress.org, but I suggest doing some investigation to see whether the developer provides support in other places.

If you are unable to enter the WordPress admin area, use your FTP client. Open the wp-content folder in the root directory. Your plugins, themes, and other directories are located in this folder.

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

Use WordPress’ built-in debugging capability if you’re having problems determining what’s causing this error to appear on your website. Pasting a bit of code into your site’s wp-config.php file enables debugging on your site. Every error that is discovered is recorded in a file in your directory.

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

If you have exhausted all other options and are still unable to discover a solution that works, moving on to the next stage is worth attempting. Create a backup of your data and download a new copy of WordPress from the main website.

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.

Was this article helpful?
Dislike 0
Views: 6