How to fix the 500 Internal Server Error

by | Aug 24, 2024 | WordPress | 0 comments

Seeing a 500 internal server error can give you a heart-attack.

A 500 error is a general status code that means that something is wrong with your website or the server. The error doesn’t give any other precise infomation. Due to that, it is a bit difficult for website oweners, especially beginners, to diagnose and fix it.

In this article, we will explain how to fix the 500 internal server error in WordPress.

How do we define the 500 Internal Server Error

Experts define the 500 internal Server Error as:

The 500 (Internal Server Error) status code indicates that the server encoutered an unexpected condition that prevented it from fulfilling the request.

So what is the cause of the Internal Server Error in WordPress?

Before we begin talking about the internal server error in WordPress, let us point out that this error is not peculiar to only WordPress. It can occur on any website running on a web server. And it is very frustrating to tackle it because of its general nature.

The following are some of the issues that can cause an internal error:

  • Corrupted .htaccess file
  •  PHP memory limit
  • Corrupted files in your WordPress installation
  • Errors in CGI and Perl script
  • issues with third-party plugins and themes
  • Problem in database server
  • PHP timing out or fatal PHP errors with third-party plugins
  • Wrong file and folder permissions
  • Browser Cache
  • corrupted database

We shall look at steps we can take to fix the possible causes of the 500 internal server error.

  1. Corrupted .htaccess file

The step to take to fix an internal error is to check for a posssible corrupted .htaccess file. The .htaccess file is a server configuration file which tells the server how to handle certain processes on the website. This includes how to ensure protection of admin area, some directories or how to redirect users etc. .htaccess is a tiny but powerful plain text file that you can use to make configuration changes to Apache on a per-directory basis. It acts as a middleman between you and the Apache web server.

The implies that a corrupted .htaccess file with bring a slew of processes to a grinding halt and inadvertently generate an internal server error.

You will need to discard the possibly corrupted old .htaccess file and create a new one. To do that, you have to access the WordPress files and change the name of .htaccess file to something different. The system will create a new .htaccess file if it cannot find one.

Wthat is the dot in front of .htaccess file for?

The dot at the beginning of the file name tells Unix/Linux systems to hide this file. Therefore, when you use the file manager, make sure that you tick the checkbox for “show hidden files” or it’s likely you might not find it.

How to access the .htaccess file

You can log into your CPanel dashboard of your hosting account and access the .htaccess file. To edit th e.htaccess file, you have to log into your site using either your hosting’s File manager or an FTP. Log into your cPanel of your hosting provider and navigate to the public_html folder which contains the .htaccess file.

file manager

Clicking Settings on the upper right corner brings a window to show hidden files. This reveals the .htaccess file

htaccess file RENAME

Dashboard of namecheap hosting showing .htaccess file in th public_html folder.

htaccess file FileZilla RENAME

Using FileZilla to connect to remote server to rename .htaccess file

After using either your hosting provider’s cPanel or an FTP software like the FileZilla to edit the .htaccess file, you have to let WordPress create a new .htaccess file for you. Login to your WordPress dashbboard and go to Settings » Permalinks page. Scroll to the bottom and click the save button without making any changes. This generates a new .htaccess file if WordPress cannot find the old one becasue you have renamed it to a name WordPress does not recognize it.

In most situations, this should fix the problem. If it does not, let’s try other possible solutions.

2. PHP memory limit

An internal error may also set in when your PHP memory is overstretching its bounds.This could happen if some plugins or theme is consuming a lot of processing memory. If you are using too many plugins, the PHP memory could reach its limit and result in an internal error. As a matter of fact, if you WordPress website is consumming a lot of memory in processing requests, you might reach memory limit and incur the wrath of the internal server error.

 You can increase the memory limit to troubleshoot this problem. This could be done by doing some modifications in the wp-config file or creating a php.ini file.

This problem can also result from  Maximum Execution Time. If a request made by the user agent takes more than the time limit set for the website process request. You can increase the max execution time limit either through wp-config file, or .htaccess file or php.ini file.

3. Faulty plugin or theme

If you have recently installed or updated a plugin, this could be causing the problem. It could be that the plugin is conflicting with other plugins. 

If it is possible to acess the admin dashboard at this point, log in and deactivate all recently added plugins or possibly, all plugins and refresh the website to find out if it works. you can aslo deactivate all the plugins without logging into your admin dashboard.

If it does, start reactivating the plugins one after the other and refresh the website after each activation to find out the plugin causing the issue. However, if the website does not work still after deactivating the plugins then it is certainly not the plugins causing the internal error.

dashboard-plugins-deactivate all

Log in to dashbaord and access plugins. Check the box, select Deactivate and Apply

Check your website’s theme. Switch to a different theme and refresh your website. It it works, then the problem is your theme. Try update your theme. Sometimes outdated or corrupt scripts and codes within the theme files can lead to an internal server error. However, if you have updated your theme, try restrore to previous version. This is why backing up your website is very important,especially before making themes, plugins, or core installation updates.  

Plugins DEACTIVATED2

Using an FTP software such as FileZilla, plugins folder is renamed as plugins_DEACTIVATED

Check your website’s theme. Switch to a different theme and refresh your website. It it works, then the problem is your theme. Try update your theme. Sometimes outdated or corrupt scripts and codes within the theme files can lead to an internal server error. However, if you have updated your theme, try restrore to previous version. This is why backing up your website is very important,especially before making themes, plugins, or core installation updates.  

3. Corrupted Core Files

If your problem remains unresolved, then its is time to consider re-uploading the core files used by WordPress. It could be that a file is corruped or broken. WordPress can work flawlessly if all directory and file permissions are correctly configured. We will re-upload the wp-admin and wp-includes folders from a fresh WordPress install. Let’s follow the following steps to get a fresh install of these core files.

Step 1: Go to WordPress.org to download a fresh supply of files. Click Get WordPress at the top right corner of the page

get wordpress

Step 2: Click download and install

get wordpress second

Step 3: Click to download the current WordPress files

download wordpress

Step 4: Unzip the WordPress zip file. This will give you a folder which contains all the WordPress core files.

This WordPress folder contains all the core files WordPress use to function properly. It includes folders such as wp-admin, wp-includes, wp-content etc. Now, it’s time to upload these core files into our WordPress website.

Open an FTP, such as a FileZilla, WinSCP etc, and connect your personal computer to the remote server hosting your website.

Follow instructions in this article to download an FTP, set it up and connect it to the remote server.

You will navigate to the files you want to upload to your website in the left column.

In the right column, make sure you navigate into the public_html directory which contans these folders. We will upload same folders to overwrite the old and possibly corrupted ones.

Back in the left column, select wp-admin and wp-includes folders. Click upload to transfer the files from your computer to your website.

core files-upload

System alerts that the folders already exist. Select overwrite to replace the old folders with the fesh ones.

core files-overwrite

If your core files or broken or corrupted, this should get your website back to life.

4. Unsupported PHP version

PHP has come a long way since its release. There are some outdated versions that latest WordPress versions do not support anymore. It is recommended that you use one of these latest versions: 7.0, 7.1, 7.2, 7.3 and 7.4.  Refer to our are on how to change your PHP version.

5. Problem on the hosting Server

Your hosting provider can be of immense help. The problem could be emanating from your service provider. There might be a problem with either the server hardware or the software. Namecheap has very outstanding customer care. Their Live Chat support will promptly help fix your problem with blazing speed.