A Step-by-Step Guide to Fix Internal Server Error in WordPress
A Step-by-Step Guide to Fix Internal Server Error in WordPress
Running a WordPress website? If so, you may have encountered an HTTP 500 Internal Server Error at least once. Unlike other common WordPress errors, the internal server error can be quite annoying since it doesn’t tell you where to look and what to fix.
Despite the fact that we love WordPress, common WordPress errors can drive us crazy be it an unknownphp error, a dreaded white screen of death or an auto-update fail. However, an internal server error is the most common error that often put a WordPress website owner in a panic mode. But relax!
If you have encountered such an error on your website, you are at the right place. In today’s post, I am going to explain what are the causes and solutions of HTTP 500 Internal Server Error.Causes of Internal Server Error
Well, the matter of the fact is Internal Server Error is not specific to WordPress, it can occur on any website powered by any platform or server. And because of the generic nature of this error, developers usually have no idea how to fix the problem.
It’s basically like asking your doctor to prescribe medication to you without telling them what the problem is.
Having said that there may be certain things that cause this error some of them are:A Corrupted plugin and/or theme functions A Corrupted .htaccess file can also trigger this problem And an Exhausted PHP memory limit Steps to Fix Internal Server Error
Fixing WordPress internal server error requires a lot of troubleshooting that may mess up your website design or functionality a bit. Therefore, before you plunge into fixing the problem on your website, it is always recommended to backup your website. Since you will be unable to access your WordPress dashboard, you can backup your site using FTP client.
Once you have a backup of your website, you are good to go!Step 1: Checking the Corrupted .htaccess File
Htaccess is a hidden plain text file that is stored on the server to control the interaction of your visitors with your site. It can also be used to block certain traffic from being able to access your website. Other functions of the .htaccess file include reconfiguring account settings, creating redirects, setting default pages, rewriting URLs, prohibiting hot links and more.
When trying to fix the internal server error, the first thing you need to do is check for a corrupted .htaccess file. All you have to do is rename your original .htaccess file to .htaccess_old and hit save.
Now refresh your WordPress website and check if the problem persists. If you have regained access to your website, your .htaccess file is corrupted and needs to be replaced with a new one. And if you are still getting an internal server error, move on to the next solution.Step 2: Increasing the PHP Memory Limit
A majority of time an exhausted PHP Memory limit causes an internal server error on your website. To increase the PHP Memory Limit of your website, follow the steps shown below:Connect to FTP client using Filezilla or Cyberduck Open your wp-config.php file from the WordPress root directory Add define('WP_MEMORY_LIMIT', '64M'); inside the main PHP tag
However, if you are unable to increase the memory limit with this method, you can try increasing the limit with the following method.Create a blank text file called php.ini Paste this code in there: memory=64MB Save the file Upload it into your /wp-admin/ folder using FTP
Again check your website if it is fixed. And if it’s fixed, you have basically fixed the error temporarily. Why? Well, there is something that is exhausting your memory limit. It can be a poorly coded theme or plugin or a function. Thus it is highly recommended to contact your hosting provider to know what exactly is causing the memory to exhaust by checking the server logs.
If increasing your memory limit didn’t solve the problem, then you probably need to do some hardcore troubleshooting.Step 3: Deactivating all plugins
If nothing works, it’s time to check your plugins. It may be possible that a particular plugin on your website is causing this error or one or two plugins are conflicting with each other. To find out which plugin is causing the internal server error, you need to deactivate all your plugins at once. If you can access your WordPress dashboard, you can easily deactivate your plugins by navigating to installed plugins page and performing a bulk action from the bulk action drop down menu.
However, if you cannot access your site dashboard, you need to connect to your FTP client or open your file manager. Once connected with the FTP client, navigate to /wp-content/folder . Inside this folder, you will notice a folder called plugins. This is where WordPress stores all its plugins and related files. Now to deactivate all plugins at once, you have to rename this folder to plugins_old. This will automatically deactivate all your plugins at once.
Did it fix the problem? If yes, one of your plugins is causing the problem and to find out which plugin is doing so, you need to play a hit and trail method. Start reactivating your plugins one after another from your WordPress dashboard until you find the faulty plugin. Once found, you can replace the plugin with another and report an error to the plugin developer.Step 4: Re-uploading WordPress Core Files
If the problem still exists, you can try uploading WordPress core files again. This solution is ideal when your website has a corrupt file. Upload wp-admin and wp-includes folder to solve the problem.
Alternatively, you can navigate to WordPress updates and hit re-install now button. Remember you should re-install your WordPress from the WordPress dashboard only.Step 5: Contacting Your Hosting Server
If everything fails, contact your hosting provider. In a majority of cases, an overloaded server causes the problem. Your hosting provider can better help you understand the problem and resolve it ASAP.
Also, if your website is hosted on a quality hosting provider, you will get support within seconds.Conclusion:
As mentioned earlier, the internal server error is an annoying error since you never get to know what is causing the error. The troubleshooting it requires is not only time consuming but also risk as you are messing with the core files of the website. However, a little patience and basic knowledge of WordPress can help you solve it quickly.
All in all, it is always a wise idea to keep a backup of your website handy, update your themes and plugins when a new update is available along with the WordPress core.
本文开发（php）相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师
本文标题：A Step-by-Step Guide to Fix Internal Server Error in WordPress