5 Reasons Your WordPress Site is Showing the 500 Internal Server Error

5 Reasons Your WordPress Site is Showing the 500 Internal Server Error

If you have been experiencing a 500 internal server error on your WordPress site, then you are not alone. This is one of the most common errors that users run into with their website and it can be confusing to fix. 

In this article, we will go over some of the most commonly suggested remedies for getting rid of a 500 Internal Server Error and hopefully get your site back up and running soon!

What is the 500 Internal Server Error on WordPress?

An internal server error is the most common WordPress errors faced by website owners. There are many ways to fix this error, but they can be difficult to do if you're not that tech-savvy. WordPress internal server errors sometimes appear in the form of a 500 internal server error.

An internal server error (or 500 internal server error) is when your website “thinks” that you typed in the wrong URL to access your site or WordPress page. This can be a problem when you're trying to access a specific page, site, or blog post. When internal server errors occur, it's usually hard for you to access your website and WordPress-run pages through the web browser.

The error code 500 is a generic error that means the server was unable to fulfill the request. The server doesn't know what happened or why. 

When internal server errors happen, users often time get an error message that says “500 internal server error” or “internal server error”. The internal error simply means that the internal server of your website cannot process requests. 

What Causes Internal Server Errors on WordPress?

There can be a number of reasons why your site might be getting this message and we will go over some ways to get rid of the 500 internal server error below.

This error isn't limited to WordPress itself. That's why the server error message is so generic and relatively unhelpful.

Understanding what's wrong when the error occurs gives you an idea of how to fix it. Remember, your website thinks that you typed the wrong URL.

A corrupt .htaccess file on the WordPress root directory can cause the internal server error, and it's the first thing you should check.

The five causes of the 500 internal server error include:

  • Corrupt htaccess file
  • Incorrect database login credentials
  • Hitting the site's PHP memory limits
  • A faulty plugin or conflicting plugins
  • Corruption of WordPress core files

How to Fix the 500 Internal Server Error

5 Reasons Your WordPress Site is Showing the 500 Internal Server Error

If you have a managed WordPress host, contact your support team to advise them of the problem to see if they can resolve the issue for you. Not every hosting provider does this, but it's one of the advantages of some hosting plans. Fixing WordPress errors is something they do regularly.

Since you can't log in to your WordPress admin console during this error, you're going to need to use an FTP client to view the files directly on your server's root folder.

Before trying any of the recommendations below, make sure you have a full backup of your site. 

Check the htaccess file first

The htaccess file controls permissions to the URLs on your WordPress site. If it's corrupt, then you'll get the internal server error.

The reason I recommend looking at the htaccess file solution first is that it's the most common cause of this problem and the easiest to fix.

Server Root

You need an FTP client to sign into your web server. From there, look in the site's root directory for a folder called public_html. 

From there, find the .htaccess file. Please note the period in front, which is essential for this file. If it doesn't show on your FTP client, check to ensure you have hidden files enabled in your View settings.

.htaccess under public_html

Once you see the htaccess file, rename it to .htaccess-old.

Now try to login to your WordPress dashboard. If this works, you're almost done correctly the corrupt htaccess file.

Next, go to Settings >> Permalinks and click the Save button. That generates a new htaccess file and could be all you need to do to eliminate the internal server error.

Increase the PHP Memory Limit

If generating a new htaccess file didn't correct the problem for you, then something else caused your internal server error. The next thing to try is to increase the site's PHP memory limit.

PHP memory is the maximum limit of RAM that a script may use on your site. Increasing the PHP memory limit provides more space for plugins and scripts to operate, but you may need to also increase the RAM available to your server in order to increase this memory limit.

Many shared or managed WordPress hosts don't even let you know the memory limit of your plan, which makes it difficult to properly prepare your server. That's why we recommend a VPS host. Check out our criteria to use when selecting your web host, and get the proper memory limit to run your site.

It's possible that the PHP memory limit occurs due to an error with a specific plugin that you haven't identified yet. A poorly coded plugin may use more resources than you have available and could cause errors.

Here's what you need to do.

  • Create a file called php.ini
  • Add this line of code: memory=128MB
  • Save the file
  • Use FTP to upload the file to the /wp-admin/ folder 

If this resolves the problem, it's a temporary fix. You need to determine the root cause of the internal server error. This change may be the thing that allows you to get inside the WordPress dashboard so you can continue investigating your WordPress plugins to find the problematic plugin.

In addition to adding to your PHP memory limit, also check to ensure that you're using the latest PHP version. Using the latest supported PHP version improves speed, security and performance for your WordPress site.

Test the Database Connection

Incorrect database login credentials may be a cause of the WordPress internal server error. After all, WordPress is a dynamic site and uses the database to generate pages for your visitors.

You need to look inside your configuration file on your WordPress website. That's where you can find the credentials you need to test your database connection.

Look for the following code in the file.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name');
/** MySQL database username */
define('DB_USER', 'user_name');
/** MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Database Manager

You'll find your database name and credentials (username and password) in this file.

Next, log in to your web host to see if you can access the database. You may find this on a CPANEL or whatever user interface your host provides.

Here's an example of how it looks in a Cloudways application for a WordPress installation. Go to the Access Details and find this in the bottom-left corner.

Click the button to launch the database manager.

If you receive an error, you may need to work with your web host to work on the database connection error resolution in order to resolve the WordPress internal server error.

Disable Plugins on your WordPress website

There are two possibilities left to correct.

  • Find the problem in a plugin
  • Replace the WordPress core 

Before you start replacing core WordPress files, check your plugins one by one to see if you can identify which one caused the internal server error.

If you still cannot login to your WordPress admin area, don't panic. You can disable all plugins using your FTP client.

wp-content

Under the public_html folder we previously discussed, look for the WP Content folder (wp-content). Within that folder, find the plugins folder.

Rename that folder to something else, like plugins-old.

WordPress looks specifically for the plugin folder to load plugins. Since you renamed it, then it can't load any plugins and they're all disabled.

You may want to try logging into your WordPress website now to see if you can get access.

If you can, then the problem is with a plugin. If not, you may need to reload your WordPress files because something with your WordPress installation is corrupt.

If you can get into your WordPress admin dashboard, disable all of the plugins and turn them on one at a time. You may discover a single plugin that causes a problem, or perhaps there are two plugins that conflict with each other.

Once you find the problem, get your plugins fixed by the vendor or perhaps rollback to a previous version that didn't cause a 500 internal server error.

Trying to debug a server error in WordPress by manually turning plugins off and on is tedious, but it's the best way to discover something that's breaking your memory limit. If you enabled debugging in the error logs, be sure to review those as you troubleshoot to see if any new messages help you identify the culprit.

We'll discuss how to reinstall WordPress in the next section.

Reinstall WordPress

It’s extremely rare, but you may have some corrupted files in the WordPress core. This isn’t anything to worry about — something may have gone wrong when your server was copying the required files, for example. Re-uploading the WordPress Core files may solve your problem.

Here’s how to reinstall the core WordPress files:

  • Get a current version of WordPress from WordPress.org.
  • Extract the files from the ZIP file.
  • Delete the wp-content folder and the wp-config-sample.php & wp-config.php files.  
  • Upload the files and folders to the website's root directory.
  • If prompted by your FTP program, overwrite all files.

Re-uploading core files allow you to ensure that you have a current and stable release of WordPress on your site. A fresh WordPress install is the best way to eliminate potential contamination or corruption of your site's files.

After the file upload, try to log in to the WordPress dashboard to test your results.

Change the default theme

You can check this by using the default WordPress theme. Use something like Twenty Twenty, or whichever is the current default Theme. If you deleted a default theme you can use this theme on WordPress.org. 

In some extremely rare cases, outdated PHP software can cause problems. 

If you can't switch a theme from the dashboard, you can change it through FTP rather easily. Just change the name of the folder for the theme you're currently using.

When you change the folder of a newly installed theme the WordPress database falls back to the default.

Turn on debugging

To find the server error in WordPress, you can turn on a debugging feature to record more data in the error logs that help you identify the problem. Server logs appear in the logs folder on the root of your server. On some hosts, the error logs may be in the wp-content folder, or even accessible in the host's user interface.

Check your wp-config file and ensure the following code is in place.

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

You may have to change a value from false to true, or add the line if it's not present.

Look for error log files that start with Apache or Nginix. You're looking for something that indicates a server error.

If you aren't sure of what to find, don't worry. Start examining the log file by searching for the word “error” and go from there.

Even if turning on the debugging doesn't give you much of a result it is a good idea to keep it turned on till a problem is resolved. 

Don't forget to deactivate it after things are right and everything has finished. Those error log files will grow with debugging enabled, so change the values to ‘false' to save disk space.

Check for permission errors

A problem with file permissions could also cause a server error in WordPress. 

Check out this article on changing WordPress file permissions.

Permissions specify who and what can read, write, modify and access them. 

WordPress requires access to files to enable certain features. Use FTP to see the permission settings for your files and folders.

  • Set all files to 644 (-rw-r–r–) or 640.
  • Set directories to 755 (drwxr-xr-x) or 750.
  • Never set directories to 777, even upload directories.

Errors due to bad hosting

It could be that you've done everything right. There are no problems with your WordPress installation and the problem comes from shared hosting. A neighboring site consumes all of the resources and there's nothing left for your site.

When that happens, the 500 internal server error may be intermittent as other sites consume resources on a server that's overloaded with WordPress sites.

When this keeps happening to your site, it's time to move. 

Summary

The problem with a 500 internal server error is that the message doesn't tell you much and you can't even get into your WP admin area.

Check your htaccess file first, as that's the most likely cause of this issue. If you can rename the htaccess file and create a new one by signing into WordPress and saving the Permalinks, it's the fastest and easiest way to fix a common reason for the 500 internal server error.

Renaming the plugins folder is another quick fix to see if you can get access to log into WordPress, and it also lets you know that a plugin is likely the cause of your problem.

Finally, make sure that you know what resources are available to you and have a way to measure what's assigned for your site. If your hosting provider won't tell you what resources you have, it's time to look for another host.

Responses

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Shares
Tweet
Share
Share
Pin