How to Fix 500 Internal Server Error WordPress?

Are you facing 500 Internal Server Error in WordPress? Here are the best solutions available for this error.

What is Internal Server Error?

The 500 internal server error runs on every page of your website or blog when there’s a problem with the server or file system that’s powering your WordPress site.

You will face this issue in WordPress dashboard, after changing URL, or when loading any page on your site, etc.

Why Internal Server Error Occur?

There are number of reasons causing 500 internal server error. Mainly it occur because of

  • Low PHP memory limit
  • Corrupted .htaccess file
  • Plugin Functions
  • Theme Functions

Increasing PHP Memory Limit in WordPress

Increase From Cpanel

If you are using Cpanel on your hosting, you can easily increase the PHP memory limit.

  • First, open Cpanel from your hosting account.
  • Under software, click on MultiPHP INI Editor link.
  • Under configure PHP INI basic settings, select your website.
  • Now, you can see the memory_limit option.
  • Then, change the value like 128M or 256M based on your server RAM.
  • Now, click on the apply button.
  • After that reboot your server.
  • Finally, memory limit successfully increased.

From php.ini File

You can easily increase the PHP memory limit from the PHP INI file. Open php.ini file, then locate Resource Limits. Under resource limits, you can see the memory_limit option. Increase the value and save it.

Memory limit in php.ini file look like this.


;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time=30

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time=60

; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64

; How many GET/POST/COOKIE input variables may be accepted
;max_input_vars = 1000

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit=128M

How to find php.ini file?

  1. Create php file and add following code.

    You can easily find your php.ini file location. Just create a php file on your website root directory and place following code and run it.

    <?php phpinfo(); ?>

    You will get your php.ini file location on screen like this

    Loaded Configuration File: /etc/php5/cli/php.ini

Increase via wp-config.php

You can also set memory limit in WordPress configuration file. Edit this file only if above methods not work. Because if you make any mistake in this file, you may face some errors on your site.

  • First open wp-config.php file with any code editor.
  • It’s located on root directory of your site.
  • Then add following code in configuration file.
define('WP_MEMORY_LIMIT', '256M');
  • Then save the file.
  • Finally, reboot your server if required.

Increase via .htaccess

You can also increase memory limit in .htaccess file.

  • First, open .htaccess file (Which is located on your website root directory).
  • If it’s not there, create a .htaccess file on your own.
  • Now, check your file, if it already has memory limit code or not.
  • If not, place this code on the .htaccess file.
php_value memory_limit 256M
  • You can also change 256M to 512M or more based on your server RAM.
  • Now, save the file.
  • Finally, reboot your server if required.

Increase via WHM

If you are using WHM on your hosting, you can easily change the memory limit. This setting will apply to your php version, So all sites (Which have this php version) settings will be changed.

  • First, open WHM from your hosting account.
  • Under software, click on MultiPHP INI Editor link on left side menu.
  • Under Configure basic settings of a PHP version, select your php version.
  • Now, you can see the memory limit option.
  • Change the memory limit to 256M or 512M based on your requirement.
  • Now, click on the apply button.
  • After that reboot your server.
  • Memory limit successfully changed.

Check .htaccess File

Currupted or misconfigured htaccess file may cause this inter server error. So you need to fix this issue with htaccess file.

  • First, check does your site has htaccess file or not. If there is no file, create .htaccess file.
  • If your site already has htaccess file, rename it.
  • Now, check your site.
  • If you didn’t see the internal server error, the problem with your htaccess file.
  • If you still getting error, try other methods.

Disable Plugins

If above methods not worked, disable all plugins and check your site. If it’s solve your internal server error problem, one of your plugin causing this issue.

Now, try to activate plugins one by one and check your site. You can check which plugin causing this issue and deactivate it. Then conatct the plugin author for further support.

If you can not deactivate your plugins via WordPress dashboard. you can deactivate via file manager.

Go to file manager and click on wp-content. Then rename the plugins folder.

Change to Default Theme

The theme also causing this 500 internal server error. So change your site theme to default theme like twenty nineteen. and check your site again.

Warnings

Only change file or setting if you know clearly about that file. If you make any mistake in editing, it will cause many errors.

Backup all your site before making any edits on your WordPress core files like wp-config.php.

General FAQ

How do I fix Internal Server Error in WordPress?

There are many reasons causing this issue. Change PHP memory limit, deactivate all plugins, change to default theme etc.

What is 500 Internal Server Error WordPress?

The 500 internal server error runs on every page of your website or blog when there’s a problem with the server or file system that’s powering your WordPress site.

How do I increase WordPress memory limit?

You can increase WordPress memory limit via php.ini file, via cpanel, via WHM and via wp-config.php file etc.

How do I increase WordPress Htaccess memory limit?

First open .htaccess file. Then place the memory limit code like this.

php_value memory_limit 256M

Leave a Reply

Scroll to top