Seeing a 500 internal server error where your website should be is enough to throw anyone into a panic. When your website goes down, you lose out on potential traffic and sales. If it’s offline for a while, it can also negatively impact your Search Engine Optimization (SEO) efforts. Fortunately, there are plenty of ways to go about fixing this error. Many of these solutions are fairly straightforward, and you don’t need a lot of technical know-how to start troubleshooting.
What is the 500 internal server error?
The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. This error response is a generic “catch-all” response. Usually, this indicates the server cannot find a better 5xx error code to response. HTTP 500 errors aren’t problems with your computer, browser, or internet connection. Instead, they’re a generic response that catches any unexplainable server error.
The 500 internal server error is frustratingly nonspecific. When the error occurs, you usually don’t get many details about it. In fact, you might not receive any information at all. The 500 error is a generic issue that isn’t specific to WordPress. Chances are you’ve seen it before during your internet explorations. Despite the name, it doesn’t necessarily mean that something is wrong with your server. It could be an issue with your website or browser.
If you do see this error on your site, you’ll want to get it fixed as quickly as possible. A 500 error can impact your SEO if allowed to linger. If your site is crawled while it’s offline, there’s a chance that search engines may interpret the error as an issue with your website. This error can also hurt your User Experience (UX) and give visitors the impression that you’re unprofessional.
Not only can a poor UX affect the way search engines rank your site, but it can cause you to lose customers as well. After all, you can’t do business if your site isn’t accessible. A wide variety of situations can result in the 500 error, making it a bit of a chore to sort out. The fact that the error message itself tends to be vague doesn’t help. Fortunately, you can solve many of these issues on your own with a bit of know-how.
Variations of 500 internal server error
This error can come up on any site you try to visit on a browser. Because it’s such a common error, there are many ways to communicate this code.
- Internal server error
- The page isn’t working
- 500 Internal Server Error
- 500 Server Error
- 500. That’s an error.
- HTTP 500.0 – Internal Server Error
- Error 500
- Error code: 500
- The server returned a 500 Internal Server Error
- Temporary Error (500)
Causes of 500 internal server error
A 500 internal server error is, as the name implies, a general problem with the website’s server. More than likely, this means there’s an issue or temporary glitch with the website’s programming. Some potential causes of a 500 internal server error include:
1. Corrupted or broken .htaccess file
A .htaccess file is a text file with important server instructions. These instructions tell your software to enable or disable specific functions. They might help you protect passwords in a directory or restrict user access. There are many ways to corrupt a .htaccess file. It can happen during plugin installation, file configuration, or while you are working on your server.
2. A permission error
Permission errors come with file protection. Permissions errors might be bugs, user mistakes, or networking problems. Usually, this error means that the user isn’t allowed to perform the action they’re trying.
3. Faulty third-party plugins or themes
To increase user features and functionality, you might add a third-party theme or plugin to your website. These plugins can be great for your site, but they can also impact site security, bugs, and performance. These plugins and themes are often created by individuals or small groups. This can be challenging because they may need more time to address bug fixes and vulnerabilities.
4. Exceeding the PHP memory limit
PHP is a server-side scripting language embedded in HTML. PHP is for managing content, databases, session tracking, and more. Each PHP process uses memory, and your hosting account has a limit for each one of these processes. If a website needs more than this memory limit, you may see an HTTP 500 error.
How to fix 500 internal server error
Unlike other server-side errors like a 502 code, a 500 internal server error is it doesn’t immediately tell you what the problem is, nor does it tell you how to fix it. If the error persists for too long on your site, it could even negatively impact your SEO. Here are some solutions you can use to fix the issue.
1. Back up your website
Before tinkering under the hood, it’s always smart to make a backup of your website. To make a complete backup, you’ll need to save copies of your WordPress files as well as your databases. You can back up your site’s files using file manager like cPanel or via FTP/SFTP. Once you’re connected to your server, navigate to the WordPress files you want to save. These files include the WordPress core installation, plugins, themes, images, and more. Now you’ll need to back up your database. Once your website is safely backed up, you can get to work on fixing that 500 error.
2. Try reloading the page
Let’s start with the best-case scenario. Some situations that cause a 500 internal error clear up on their own within a few minutes. For example, if you’ve just made changes to a plugin or theme, or if your host is experiencing unusually heavy traffic, you may see a server error. If this is true in your case, you’re in luck, as a simple page reload should get things back to normal. Therefore, the first thing to try is simply waiting a minute or two, during which the error will hopefully resolve itself. Then you can try reloading the page by pressing F5 or (Command + R if you’re using a Mac).
3. Clear your browser cache
Another potential server error fix that’s quick and easy is clearing your browser cache. It’s possible the cache became corrupted, which would cause problems when attempting to access websites. First, you might check Down for Everyone or Just Me or Site Down or Not. This will determine whether there’s a widespread problem or you’re the only one experiencing difficulties. If you’re alone in your 500 error frustration, the problem may be your browser. Try accessing your site from a different browser. If an alternative works, it’s a sign that the issue is with your cache.
- In Google Chrome, you can clear your cache by pressing Ctrl + Shift + Delete. Alternatively, you can click on the three vertical dots in the top-right corner, followed by More tools > Clear browsing data. Be sure to check the “Cached images and files” box. Then click on the “Clear data” button.
- In Firefox, you can clear the cache using the Ctrl + Shift + Delete keyboard shortcut. This will open the “Clear Recent History” window. In the “Time range to clear” drop-down menu, select “Everything”. Check the “Cache” box, and then click on “OK”.
- In Safari, you can navigate to the “History” menu item and choose “Clear History”. Keep in mind that this will delete everything, including cookies and visited pages.
Once you’ve cleared your browser cache, you can attempt to access your website again. If you’re still seeing the 500 internal server error, it’s time to move on to more involved fixes.
4. Access your error logs
Your site’s error logs may provide insight into what’s causing the 500 error. Depending on your host, these logs may be cycled quite often, so you’ll want to take a look as soon as possible. You can check your error logs by accessing your site’s files via cPanel or FTP/SFTP and looking for the /logs directory. You may see several directories at this point.
You’ll want to check the one with the most recent date. Hopefully, your error logs will provide you with some additional context for the 500 error. Another option is to enable the WordPress debug log. You can do this by opening your wp-config.php file. Within it, look for the following line:
define('WP_DEBUG', false);
Once you find it, replace it with the following:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
This will create a debug.log file, which you can find under the /wp-content/ directory. Just be sure to change the WP_DEBUG value back to “false” when you’re done troubleshooting.
5. Check for the “Error Establishing a Database Connection”
If there’s been an error establishing a database connection, not only will your site be offline for visitors, but you won’t be able to access the WordPress admin dashboard either. There are a few possible causes of this:
- Incorrect database login credentials.
- A corrupted WordPress database.
- A corrupted WordPress installation file.
Let’s start with incorrect login credentials, as this is a common cause of the database connection error. Navigate to MySQL Databases. Here, you’ll find your database name, username and password. Next, you’ll compare these credentials to those in your wp-config.php file. You can access this file in your site’s main directory via cPanel or FTP/SFTP. Verify that the information under MySQL Settings matches the one in your wp-config.php file.
Next, if your database is corrupted, you can quickly repair it through MySQL Databases by clicking on “Repair Database”. Alternatively, go to phpMyAdmin, open the database you want to repair. Check all of the tables in the database, and then choose the “Repair table” option from the drop-down menu.
6. Look for permission errors
If any of your files have permissions set incorrectly, you may see the 500 internal server error as a result. Again, you can check and change these permissions using cPanel or FTP/SFTP. Right-click on any file and select “File permissions” to open a new dialogue window. In this window, you can check and, if necessary, set new permissions for the file. Typically, you’ll want to set files to “644” and directories and executables to “755”. However, you may want to check with your host if you’re unsure about the correct values.
7. Increase your PHP memory limit
Another reason you might see the 500 internal server error is if you’ve exceeded your server’s PHP memory limit. There are several ways to increase your limit, and they all involve using cPanel or FTP/SFTP. Before you try increasing your memory limit, you may want to start by seeing what it’s currently set to. You can do this through the WordPress admin dashboard. Keep in mind that, with some variations of the 500 error, you won’t be able to access the dashboard.
From your WordPress dashboard, navigate to Tools > Site Health. Click on “Info” at the top of the screen and scroll down to the “Server” section. You should see your “PHP memory limit” there. If this resolves the 500 error, your next task will be to figure out what is causing the memory limit exhaustion. It could be a problematic plugin or theme. You might consider reaching out to your host for help on finding the exact server diagnostics.
8. Check for problems with your .htaccess file
Your .htaccess file is one of the core WordPress files. It contains rules for your server, so it could contribute to a 500 internal server error. If your .htaccess file has become corrupted, you’ll want to go ahead and create a fresh one. Start by finding your .htaccess file using cPanel or via FTP/SFTP. Rename the file to .htaccess_old. Now, create a new .htaccess file and paste in the following:
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Then refresh your site in your browser, and check to see whether the error message is showing.
9. Look for coding or syntax errors in your CGI/Perl script
If you’re running Common Gateway Interface (CGI) scripts, any coding errors you’ve made could result in a 500 error. To unearth potential issues with your CGI scripts, log into your site using Secure Shell Access (SSH). Once you’ve logged in, you can troubleshoot your CGI with this command:
[server]$ ./cgi_name.cgi
The terminal should return a general error message and the line number the culprit is located on. From there, you can work your coding. When working with CGI, there are a few best practices to keep in mind to avoid problems. First, it’s wise to use a plain text editor to ensure that you maintain ASCII format. When you upload scripts, you should also be able to select ASCII mode in your FTP client. Finally, if necessary, upload to the cgi-bin directory on your server. Then you can double-check your files’ permissions once you have them uploaded.
10. Ask your web host about potential server issues
If all else fails, there may be a server issue, which only your host can confirm. Unfortunately, if your host’s server is experiencing a problem, you may have to wait out some website downtime.
Get your WordPress website back on track
While having to sort out a 500 internal server error isn’t exactly fun, it’s also not as painful as you might imagine. With a little patience and the tips we’ve provided, you should be able to make some progress on getting your website back online. You can start small by refreshing your page and clearing your browser cache. Then you might want to move onto more involved fixes, such as increasing your PHP memory limit. If you’re not able to resolve the error on your own, reach out to your host.