CODE CODIFY.CLUB

Fixing the 500 Internal Server Error in WordPress

Let’s assume that your website is working fine until a few days back, a minor glitch takes place, and it escapes your mind. Suddenly, you start observing a 500 internal error on every page of your website. Don’t worry! I know that you are now panicking out that you have just located a 500 internal server error on your WordPress website but there is a solution for almost everything on WordPress. It’s due to the nature and diversity of the CMS itself that you can find a solution for everything.

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.

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.

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 and verify if there is anything unusual then normal wordpress .htaccess file.

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 often.

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:

  • Functions.php File
  • .htaccess File
  • PHP.ini File
  • wp-Config.php File

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.

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.

V!ral

Developer, Technology aficionado, Beer Lover and founder of codify.club Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed