0

A Guide to Fix WordPress 500 Internal Server Errors

Do you see the 500 Internal Server Error message in your WordPress admin area? Don’t worry. You’re not alone.

500 Server Error is a standard error that occurs for various reasons. Our comprehensive guide will train you on how to fix the 500 internal server errors in WordPress. We will cover all possible causes and solutions so that you can get your website back up and running as quickly as possible.

The 500 Internal Error is one of the common issues that can occur for various reasons. The most common causes are plugin or theme errors, incorrect file permissions, and corrupted files.

Causes of the 500 Internal Server Error

You may see this error message in your WordPress admin area for many reasons. The most common causes are

  • a corrupted or wrong code .htaccess file
  • PHP memory limit
  • incorrect file permissions
  • WordPress plugins and themes errors
  • or an issue with your host.

Solutions to the 500 Internal Server Error

You can try several solutions to fix WordPress’s 500 Internal Server Error. The following are some of the most common answers.

Common Steps before debugging

Try reloading the page to see if the issue is temporary. Also, clear your browser cache and try reloading. Sometimes WordPress may recover immediately when the page gets refreshed.

Debug your .htaccess file:

The most common cause of a 500 server error may be triggered by a corrupted or wrongly coded in the .htaccess file. Fix the htaccess by following the instructions below.

You can check your .htaccess file by connecting to your site via FTP (via your SSH, Cpanel, or Maybe local server)and renaming the .htaccess file to something like .htaccess_old. If you don’t have a .htaccess file, you can create one.

To create a .htaccess file:

  • Connect to your site via FTP.
  • Navigate to the root directory.
  • Create a new file, call it .htaccess
  • and add the following lines of code:

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

You can add the above code if you have an empty .htaccess file. Please save the file and upload it to your /wp-content/ directory. Try refreshing the page to see the changes.

PHP Memory Limit

Suppose you see the 500 Internal Server Error message when your PHP memory limit is less than 128M. It would help to increase the PHP memory limit to eliminate the error.

To do so, add the following line of code to the wp-config.php File:

define(‘WP_MEMORY_LIMIT’, ‘256M’);

Then try reloading the page if you still see the 500 Internal Server Error message. Please note that the memory limit changes may not work in some cases. In that case, try out other methods explained below. If you can’t do it yourself, always contact the hosting provider/server admin to change it.

Incorrect File Permissions

Another common reason is incorrect file permissions. WordPress needs certain files and directories to have specific file permissions to work correctly.

You can check your File permissions by connecting to your site via FTP and navigating to the /wp-content/ directory.

The correct file permissions for WordPress are:

  • set all the files to 666 or -rw-rw-rw-
  • set all the directories to 777 or drwxrwxrwx

If you see any file or directory permission is set with other than 666 or 777, then you should fix their permissions. To do this, right-click the file or directory and select “Change Permissions” to set the required file permissions.

Turning on debugging

Debugging is the process of troubleshooting errors and issues on a website. When turning on debugging, WordPress will write more information to the debug.log file, which can help you troubleshoot the problem. You can turn on debugging by adding the following line of code to your wp-config.php file:

define(‘WP_DEBUG’, true);

Once added above code, you can save the file and upload it to your /wp-content/ directory. After you have uploaded the file, you can try refreshing it. Still not resolved? Try turning on debugging mode by adding the following line of code:

define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, true);
define(‘WP_DEBUG_DISPLAY’, false);

After adding the lines of code, you can save the file and upload it to your /wp-content/ directory. After you have uploaded the file, you can try refreshing it.

Access your error logs

Next, you can try accessing your WordPress error logs to help troubleshoot the issue. You can access your error logs by connecting to your site via FTP and navigating to the /wp-content/ directory. The error logs are located in the /wp-content/ directory and are named debug.log and error_log.

You can view your error logs by opening the file in a text editor like Notepad or TextEdit. Once opened, search the file and find any errors that seem to be related to the 500 Internal Server Error message. If you find any errors, try fixing them and refresh the page to confirm it’s working now.

Check if the WP Admin and login access work.

If you see the 500 Internal Server Error message in your WordPress admin area, there are a few steps you can do to troubleshoot and fix the issue.

One of the first things you should do is check to see if the admin works. Visit your website and add/wp-admin to the end of the URL.

Step 1.

If you are not able to access the wp-admin dashboard, then it means that there is an issue with your WordPress installation. You can try troubleshooting the problem by connecting to your site via FTP and navigating to the /wp-content/ directory.

Error Establishing the DB Connection

If any page loads with an “Error Establishing a Database Connection” message, first check the database settings and values in your WordPress config file.

Connect to the website via FTP and navigate to the /wp-content/ directory. The database settings are in the wp-config.php file. You need to check the configuration of the below items:

  • the database name
  • the database username
  • the database password
  • the database hostname

You must update and save the file even if these settings are incorrect. Once you have saved the file, you can try refreshing it.

Step 2.

If you can access the wp-admin dashboard, then it means that your WordPress installation is working correctly. You have to log in with admin credentials to debug the issue.

Revert Recent Changes done in WordPress

Suppose you made some recent changes to your WordPress site; that may be the reason for the 500 Internal Server Error message. Then you can try reverting the most recent changes from backup to see if it works. Connect to your site hosting via FTP or host panel like CPanel, and navigate to the file that you need to revert the changes and restore them to the old backup state

Audit Your Plugins, Extensions, and Modules

Auditing your WordPress plugins, extensions, and modules is vital to maintaining a healthy website. Regular audit of your plugins, extensions, and modules is always a good idea to ensure they are up-to-date and functioning correctly.

To audit your plugins, extensions, and modules, you can use a plugin like WP Security Scan. The plugin scans your website configured for any security vulnerabilities and provides a report of the findings.

Suppose you find any plugins, extensions, or modules that are out-of-date or not functioning correctly. In that case, you should update or remove them from your website. Updating or removing plugins, extensions, and modules is a simple process through the WordPress admin dashboard.

You can contact the plugin developer for assistance if you cannot update or remove a plugin, extension, or module.

Deactivate plugins and switch themes

Deactivating plugins and switching themes are two standard methods of fixing WordPress’s 500 internal server errors.

Deactivating plugins can be done by visiting the WordPress admin dashboard and clicking on the Plugins link. Make sure a safe backup is done and follow the next step.

Once you land on the Plugin management page, you can deactivate all of the plugins by selecting the Deactivate option under the Bulk Actions drop-down menu.

After deactivating all the installed plugins, try refreshing your website to see if it works. If resolved, then the problem is with one of the plugins. You can reactivate all the plugins or restore them from backup.

Now start deactivating the plugins one by one. Always start from the most recent installed or modified. Reload the site after deactivating each plugin to see if that solves the 500 error to find the actual culprit. You can remove the troublesome plugin and update or keep it inactive to keep the site loading.

In another case, the issue may be because of a theme. You can try switching to a default WordPress theme if that is the case.

Switching to a default theme is done by visiting the WordPress admin dashboard and clicking on the Appearance link. Once you are on the Appearance page, click on the Themes link.

On the Themes page, you will see a list of all available WordPress themes. You can activate a default WordPress theme by selecting it from the list and clicking on the Activate button.

After activating a default WordPress theme, you can try refreshing your website to see if the issue still exists. If the fix worked, the issue is with the previous or child theme. Debug the wp theme to fix the problem before reactivating. You can get help from a developer in case of technical issues.

If the 500 internal server error still occurs, you will need to troubleshoot the issue further.

Additional Resources

Still experiencing problems with the 500 type Server Error? Please refer following resources for more info:

WordPress Support Forum: https://wordpress.org/support/forum/how-to-and-troubleshooting

SitePoint: https://www.sitepoint.com/community/ 500 -internal-server-error/6481

Check with your host.

These articles are a great starting point, but if you are still having problems, we recommend that you contact your host directly for assistance. They will be able to help you troubleshoot the issue and get your site up and running again in no time.

I hope now you know how to fix the 500 Internal Server Error in WordPress. If you still have questions, please let us know in the comments below.