Fixing The 500 Internal Server Error In WordPress

Fixing The 500 Internal Server Error In WordPress

So What Is a 500 Internal Server Error?

An internal server error is an application-side issue that can occur on your web server. When you write a specific URL into the address bar or if you click a link on a website, you are requesting the server to show you a page. Presently, for some reason, the server can’t show you that specific page you are seeking which signifies that you are facing an Internal Server Error.

Fixing The 500 Internal Server Error In WordPress

Just to be on the safe side, always remember that it is necessary that your hosting provider offers you automated backup.

Create a Backup

Most of the time, you are not responsible for the errors that occur on your hosted server. Since humans can make mistakes so can servers do since they are managed by people only. Some of these errors are severe and may end up compromising your whole website, therefore backing up website data on your server should be a mandatory practice.
However, if your hosting provider fails to provide you the right options to backup website data, you can try the following WordPress Backup Plugins.

How to Resolve 500 Internal Server Error on Your WordPress Website

Many reasons can be highlighted as per why the server raises a 500 Internal Server Error on your website. To fix this persistent issue, it is necessary that one should identify the cause of occurrence. The two common causes of this error to erupt on your website is corrupt .htaccess file and PHP memory limit. So without further Ado, let’s discuss how we can fix them.

The .htaccess File Error Fix

If your .htaccess file is corrupt, this can cause a 500 internal server error. The .htaccess file is usually affected by a module or a broken installation of a theme. In this case, you should first access your .htaccess file.  To determine this issue, login to your FTP account. Once logged into your FTP account, you will see a .htaccess file available in the root directory along with other folders such as wp-content, wp-include and wp-admin.

Fixing The 500 Internal Server Error In WordPress

Now that you have located your .htaccess file, you can download it from the live server to a local location on your PC. Next, open this file in your text editor (Notepad++, Dreamweaver, etc).

Navigate to this link: https://codex.wordpress.org/htaccess and copy – paste the version of the code that fits best for your website. Then, save the .htaccess file and upload it to the live server.

The code differs for different WordPress configurations and installations. Suppose you have used WordPress Multisite in WordPress 3.5 or later, then you need to use the following code:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

Now, reload your website to see if the 500 internal server error is fixed. If it is fixed then that would be great, but if not then navigate to the next step.

Increasing PHP Memory Limit in WordPress

Another way of fixing the 500 Internal Server Error is by increasing the PHP Memory Limit. Your host and WordPress set the PHP memory limits by default. As soon as you observe a memory drop, the server automatically displays a 500 Internal Server Error. To avoid such discrepancy, simply increase the PHP memory limit in WordPress and check whether your website works fine or not. This way you can seemingly result in avoiding the 500 Internal Server Error to occur on your website oftenly.

Some of the most common ways of increasing a WordPress website’s PHP memory limits is by altering the code in one of these files:

Here is how you can tweak with these files and

Functions File

Navigate to your root directory and find function.php file. Right-click on this file, and select Download. It will download the file to your PC. Open the file in your text editor and include this bit of code below the opening PHP tag:

    @ini_set(‘upload_max_size’ , ’64M’);
     @ini_set(‘post_max_size’, ’64M’);
     @ini_set(‘max_execution_time’, ‘300’);

.htaccess File

You can also use a .htaccess file for increasing PHP memory limit. Just go to your root directory, and find .htaccess file. Right-click on the file, and select Download to download it on your PC. Now, open the file in your text editor and include this bit of code below the opening PHP tag:

    php_value upload_max_filesize 64M
    php_value post_max_size 64M

WP-Config File

You can also use a wp-config.php file for increasing PHP memory limit. Just go to your root directory, and find wp-config.php file. Right-click on the file and select Download to download it to your PC. Open the file in your text editor and include this bit of code below the opening PHP tag:

define(‘WP_MEMORY_LIMIT’, ’64M’);
   ini_set(‘post_max_size’, ’64M’);
   ini_set(‘upload_max_filesize’, ’64M’);

PHP.ini File

You need to create a php.ini file and paste the below code in it. Upload the following code in the wp-admin/ directory.

    memory_limit = 64M
    upload_max_filesize = 64M
    post_max_size = 64M
    file_uploads = On

If these two possible ways aren’t enough to resolve the 500 Internal Server Error, here are a few more ways through which you can avoid this Server Error to occur in your WordPress website.

Deactivate All Plugins

If you have access to the admin dashboard of your WordPress website, deactivate each plugin one by one. Refresh your website after each deactivation.

Fixing The 500 Internal Server Error In WordPress

Then check your website again. If the site starts functioning properly, then the internal server error must be due to the plugin installed on your WordPress. Now, you need to activate each plugin one by one and refresh your website after each plugin activation. The problematic plugin will soon be identified as it will result in a 500 Internal Server error for your website.

Ideally, at this point, the issue has been settled. If not, move to the following step.

Fresh wp-admin & wp-includes

In this section, you need to download new wp-admin & wp-content folders and upload to live host via FTP.  Make sure that you have backed up the website before this step.

Contact Your Hosting Provider

If the problem persists even after the investigation of these common causes, then it is advised that you should contact your hosting provider. You can place a request so the technical experts can resolve your issue by going over your server settings.

One can find multiple error messages related to the 500 Internal Server Error message as they are all server side errors. Such an example of a 500 error is the 502 Bad Gateway Error.

Concluding Thoughts

We hope you found this guide helpful and that you were able to solve your “WordPress 500 internal server error” problem. Have you figured out any other way to get rid of this problem? Please share your solutions with us in the provided comment section below. I am sure, it will be beneficial for others who are facing similar issues.


Jayesh Patel
Author
Jayesh Patel

Jayesh Patel is a Professional Web Developer & Designer and the Founder of InCreativeWeb.

As a highly Creative Web/Graphic/UI Designer - Front End / PHP / WordPress / Shopify Developer, with 14+ years of experience, he also provide complete solution from SEO to Digital Marketing. The passion he has for his work, his dedication, and ability to make quick, decisive decisions set him apart from the rest.

His first priority is to create a website with Complete SEO + Speed Up + WordPress Security Code of standards.



Explore

Related Articles

11th April, 2024

W3 Total Cache: A Comprehensive Review & Guide for 2024

8th April, 2024

Top 10 Must-Have Web Design Resources and Tools for 2024

8th April, 2024

Unleash Accessibility Potential in Front-end Development