How to fix 500 Internal Server Error in WordPress..

HostSailor

Well-known member

In WordPress, the HTTP status code 500 Internal Server Error is a commonly seen one and it can be caused by various reasons. Here we are discussing some major reasons behind this.

1. Incorrect File/Folder permission/ownership.

This issue is usually happening when the website is migrated from a different server or doing the file transfer from the command line. We need to check and make sure all files inside the WordPress directory is having 644 and folders are having 755 permission and ownership is set to the user.

- Change permissions using 'chmod' command:
Eg: # chmod 755 wp-admin

- Change ownership using chown command:
Eg: #chown jack. wp-content

- If the permission or ownership needs to be changed recursively, you need to use -R option with the command:
Eg: #chown -R jack. wp-content



2. Incorrect .htaccess file.

If a lot of custom rules are set in the .htaccess file, it might be the cause of this issue. You have to double-check and make sure that the rules are correct. Here I have provided a default .htaccess to be used with a WordPress website:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress


3. Remove/Disable faulty plugins.

In some cases, plugins are causing the issue. If there are a lot of plugins that are used, better to disable them one by one and find if some of them are causing issues. If the WordPress admin panel is not available, you can disable the 'plugins' directory inside 'wp-content' by renaming it like plugins_bak. If the website works after renaming, it means that some of the plugins are causing the issue. You can then revert it and check each of the plugins to find which one is the culprit.

4. Increase PHP Memory Limit.


In some cases, the error can be caused by a very low memory limit set in the PHP configuration. If you are using any web hosting control panel, you can increase it from there. Otherwise, you can just create a custom php.ini in the home directory and provide the required PHP values there in the file.
 
Top