How to Fix 500 Internal Server Error in WordPress

If you have been using the internet for a while, you must have come across the HTTP 500 internal server error a couple of times. It’s quite common, this error, and it doesn’t plague WordPress sites only. The 500 internal error arises because something is a miss with your WordPress site or your web server. Worst part is you really can’t tell where the problem lies until you run the diagnostics.
If you tried accessing your WordPress site but were met with a 500 internal server error, rest easy as this post addresses the common causes of this frustrating problem. Before you do anything though, I strongly urge you to create a full backup of your WordPress site so you can revert back to a previous version should the unavoidable happen. That aside, please ask your questions and share your experiences and suggestions in the comments to make this post more resourceful.
What Causes the 500 Internal Server Error?
Before you charge out trying to solve your predicament, how about furnishing yourself with the things that might throw the infamous internal server error at your face? You wouldn’t expect your mechanic to repair your vehicle without first explaining the problem, now would you?
The most common causes of the 500 internal server error in WordPress are:
- Problematic plugin(s)
- Insufficient PHP memory
- A corrupted .htaccess file
- Missing or corrupted files in the WordPress Core
- Issues with your web hosting account
How to Fix the 500 Internal Server Error
Let us now diagnose and alleviate these causes one by one.
Chances are, if you are seeing the internal server error, you probably can’t access your WordPress admin area. While some of the instructions in this post require you have admin access, don’t despair if you can’t login to your dashboard yet. You can still access your WordPress files using an FTP client such as FileZilla. Sure, you can use the File Manager offered by your host, but FileZilla makes the process easier and more fun.
How to Access Your WordPress Site Using FileZilla
First off, download and install FileZilla on your system. Launch the program and navigate to File -> Site Manager. Click on the New Site button to create a new entry for your website.
Then fill out the form to the right as follows:
- Host: Enter your domain name e.g. www.example.com
- Port: Leave this blank
- Protocol: Choose FTP – File Transfer Protocol
- Encryption: Only use plain FTP (insecure)
- Logon Type: Normal
- User: Enter username you use to access your file system/cPanel
- Password: Enter the corresponding password i.e. password you use to access your file system/cPanel
Secondly, click on the Transfer Settings tab.
Tick the “Limit Number of Simultaneous Connections” box and enter 8 as the number. This ensures your server doesn’t kick out your IP address. Next, click on the Connect button to log in to your web server. If all goes well, you’re ready for the next part. If not, ensure you have the correct user/password combination. Check with your host if you must.
That out of the way, let’s begin with cause numero uno.
Problematic Plugins
You can check whether the internal server error is due to a problematic plugin by deactivating all plugins and reactivating them one by one. Deactivating all plugins even without WordPress admin access is super-duper easy.
Just open FileZilla, navigate to your root directory (the folder where your WordPress site lives), and open the wp-content folder. This folder contains your themes, plugins and other folders.
Next, rename the plugins folder to plugins.old or anything else you wish. This will deactivate all the plugins. Now refresh your site in the browser. If the internal server error is gone, you have a faulty plugin to deal with.
What to do next? Just login to your WordPress admin area and reactivate each plugin one by one, while refreshing your website after each reactivation. The faulty plugin will cause the error after activation when you refresh your site. Delete the problematic plugin’s folder via FTP to eliminate the error. You can replace it with a better alternative if the function is essential for your site. You could give the developer a heads up as well.
Reactivate every other plugin after the faulty plugin, refreshing your site with each reactivation to ascertain you are clear of problematic plugins. Pat yourself on the back if the error goes away after fixing your plugins. Rename plugins.old folder back to “plugins”.
Insufficient PHP Memory
If your site has grown considerably big over time, runs too many plugins or uses a poorly-coded plugin, you’re more prone to memory issues hence the 500 internal server error.
Goes something like this: If your huge site is exceeding the PHP memory set by your host, you will get an error. Have a cheapjack WordPress plugin that hogs server resources? You’ll end up with the 500 internal server error. Running too many plugins that demand more memory than your server can provide? Getting the 500 internal server error is just a matter of when.
According to Lyn Wildwood:
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 place on your server.
You can increase your PHP memory limit by adding:
define ('WP_MEMORY_LIMIT', '64M');
…to your wp-config,php file, which is found in your root directory. Open your root directory and locate wp-config.php. Download the file to your computer, and open it with your text editor. Add the above code immediately under the opening <?php tag. Save wp-config.php and re-upload the file replacing the existing version. Refresh your site.
If the internal server error disappears, something is exhausting your memory limit. You need to determine what is using up your juice, or move to a better host that can offer more memory as per your needs.
Corrupted .htaccess File
You can easily break your .htaccess file after installing a plugin or making changes to your WordPress site. However, you can surmount this problem cheaply since all you have to do is create a new .htaccess file.
Just open your WordPress root directory using FileZilla. You are in the right place if you can see folders such as wp-content, wp-includes and wp-admin.
.htaccess and other dot files are usually hidden by default, so you need to show hidden files. If you can’t see your .htaccess file, just click Server on your FileZilla menu, and choose Force Showing Hidden Files.
Next, rename your existing .htaccess file to .htaccess.old. Refresh your site, and if the 500 internal error is gone, it was caused by a corrupted .htaccess file. After this, go to your WordPress admin area, navigate to Settings -> Permalinks and click the Save Changes button. This should create a new .htaccess file for your site.
Missing or Corrupted WordPress Core Files
You could get the internal server error if your WordPress core has a corrupted or missing file. Well, this is easy to fix:
- Download a fresh copy of WordPress (Make sure the fresh version matches the version you’re using)
- Extract the .zip archive on your computer
- Using FileZilla, upload the wp-admin and wp-includes folders to your WordPress root directory, overwriting the existing folders
- Refresh your site
If the error is gone, you deserve a medal; you’ve been working so hard to restore your site to it’s former glory.
Problematic Web Server
At times, the internal server error isn’t a problem of your own making, It could be as a result of a misconfigured server or any other host-related problem. If this is the case, there’s little you can do on your end to fix the internal server error. Have you tried the above solutions but nothing seems to work? It’s time to enlist aid from your host. They usually have server logs from where they can tell where the problem lies.
Conclusion
The 500 internal server error is infuriating to say the least. It has a couple of causes and solutions as we have seen here today. The depressing part is you have no exact method to pinpoint the origin of a problem that leaves you with downtimes you’d rather avoid. This error costs you time, money and reputation, but with this guide, we hope to alleviate some of that stress.
Ever encountered the 500 internal server error on your WordPress site? How did you fix it? Please send in your questions and suggestions via the comment section below!
Leave a Reply