How to Fix the ‘500 Internal Server Error’ in WordPress?

If you have been facing a ‘500 Internal Server Error' in your WordPress website, then this article will be helpful to you. The '500 Internal server error' is not WordPress-specific, and it can happen with any website you host with any web server. There are several reasons why this error can occur. 

Its generic nature makes it annoying to fix since it won't show the actual error in the browser, making the rectification difficult.

To send the actual errors to browsers for the Windows-based servers, you will have to log in to the Web server and browse the WordPress website from the server itself. 

To check actual errors in Linux-based servers, you will have to dig the server logs for the exact cause of the 500 errors. 

What causes the 500 Internal Server Error?

The Internal Server Error often arises from issues such as corrupted .htaccess files, introducing a new theme or plugin, an incompatible PHP version, or a recent WordPress update.

An effective troubleshooting strategy involves retracing your steps. Recall the specific event that led to your site stopping functioning. Once you identify the root cause, refer to the provided list to find the optimal solution.

Error code

HTTP Error 500

Error type

Code error

Error variations

500 Internal Server Error

HTTP 500

Error 500

HTTPS 500 error

Temporary Error (500)

HTTPS error 500

HTTP Error 500 – Internal Server Error

The website cannot display the page – HTTP 500

Error causes

Corrupted .htaccess file

Corrupted or incompatible theme

Corrupted or incompatible plugin

Incompatible PHP version

WordPress updated version incompatible with other elements

 
We have compiled all possible causes of the ‘500 Internal Server Error' in WordPress along with troubleshooting steps.

500 Internal Server Error in WordPress

Please note: Before starting the troubleshooting process take a backup of your WordPress site. By backing up your WordPress site, you are ensuring that all your valuable content, themes, plugins, and configurations are safely stored away. In case anything goes wrong while attempting to resolve the error, you can easily restore your website to its previous state without losing any critical information.
 

 

Cause 1: Memory Exhausted

This error also occurs if your WordPress website exhausts the memory limit. It could be a poorly coded plugin or a theme that is exhausting your memory limit. To fix this, you will have to increase the memory limit in WordPress. 

  • Open the wp-config.php file located under the root WordPress directory. 
  • Add the following line in wp-config.php  

define('WP_MEMORY_LIMIT', '128M');

php_value upload_max_filesize 128M

php_value post_max_size 128M

php_value max_execution_time 300

php_value max_input_time 300

php_value memory_limit 256M

  • Save the file.
  • If you still get this error after this fix, you will have to extend the PHP Memory limit from the php.ini file

You can contact your web host to increase the PHP memory limit.

Cause 2: WordPress 500 Internal Server Error Is Due to Corrupted .htaccess File

  • To eliminate the server error 500, you can examine your existing .htaccess file to ensure it is not corrupted. Alternatively, you have the option to generate a brand-new one. Follow these steps:
  • Log into your cPanel account.
  • Navigate to Files and choose File Manager.

  • Search for the .htaccess file inside public_html.

  • Disable the .htacces file by renaming it and creating a new one.
  • Right-click on it and click Edit.
  • Copy-paste the default WordPress .htaccess code into the newly created file.

  • Click on Save.

Cause 3. Deactivate the plugins.

You can deactivate plugins in four ways:

1. Deactivate all plugins through cPanel

2. Deactivate all plugins through phpMyAdmin

3. Deactivate all the plugins one by one

4. Disable all the plugins in bulk

Let's check all four one by one:

1. Deactivate all plugins through cPanel

  1. Log in to cPanel
  2. Under the Files section, go to File Manager.
  3. Select Web Root (public_html/www) and click Go.
  4. Expand the public_html folder, and navigate to the /wp-content/plugins folder.
  5. Right-click on the /wp-content/plugins folder and rename it to plugins.old.
    This will deactivate all of the plugins at once.
  6. Now, reactivate the plugins folder again by renaming it back to plugins.
    This will allow you to access the WordPress dashboard again.
  7. In the WordPress Dashboard, reactivate each plugin (one at a time) and reload your website to see if the ‘500 Internal Server Error' is fixed.

2. Deactivate all plugins through phpMyAdmin

  1. Login to phpMyAdmin and locate table wp_options
  2. Under the option_name column (field), find the active_plugins row
  3. Change the option_value field to: a:0:{}

This method can determine the offending plugin and isolate it to resolve the ‘500 Internal Server Error'.

3. Deactivate all the plugins one by one

  • Login to your WordPress dashboard.
  • Navigate to Plugins > Installed Plugins.

  • Deactivate all the plugins one by one.
  • Activate each plugin individually and test your site after enabling each one.
  • If your site functions correctly, leave the plugin active. If you encounter the error, you can identify the problematic plugin causing the issue.

4. Disable all the plugins in bulk:

To troubleshoot this issue, you can start by temporarily disabling all your plugins. This will help determine if any of them are causing the problem.

  • Log in to the WordPress Dashboard and Navigate to the Plugins Section.
  • Select All Plugins.
  • After selecting the plugins, look for the Bulk Actions dropdown menu. Choose Deactivate from the dropdown, and then click the Apply button. This will deactivate all the selected plugins at once.

  • Visit your WordPress site that Verify if the issue is resolved. proceed to the next step.
  • Go back to the Plugins section in the dashboard. Reactivate the plugins individually, and after each reactivation, assess your website to determine error persists. This process helps identify the specific plugin causing the conflict.

Cause 4: Re-uploading Core Files

If disabling the plugin does not fix the ‘500 Internal Server Error', then the only option you are left with is to re-uploading the wp-admin and wp-includes folder from a fresh WordPress install. 

  • Download the most recent version of WordPress & extract the files on your computer.
  • Within the extracted files, remove the wp-config-sample.php file and the wp-content folder to prevent the overwriting of crucial data.
  • In cPanel, transfer all the core WordPress files to your site’s directory and replace the existing files.
  • When a confirmation screen appears, mark Always use this action and Apply it to current queue-only columns. This ensures that you won't have to confirm the overwrite for each file.
  • That concludes the process. Simply wait for the operation to complete.

Cause 5: WordPress 500 Internal Server Error Is Due to Themes Installation

A frequent cause of the HTTP status code 500 is a new theme or update. To resolve this, switch to a different theme or revert to one of the default options.

Let's see both options:

  1. Editing the existing theme
  2. Reverting to default theme

1. Editing the existing theme

If you can access the WordPress admin area, attempt to change the theme from there. Alternatively, you can edit the MySQL database to change themes through phpMyAdmin in the control panel.

  • Log into your cPanel account.
  • Navigate to Database and choose phpMyAdmin.

  • Head to the wp_options table.
  • Locate the template and stylesheet rows.

  • Click on Edit and change the value of the template and stylesheet to the default theme, like twenty-twenty.
  • Now, refresh your site with the new theme and check if it has resolved the issue.

2. Reverting to default theme

  • Log in to the WordPress Dashboard and Navigate to the Themes Section.
  • Look for a default WordPress theme, such as Twenty Twenty-One or any other standard theme that comes pre-installed with WordPress. Hover over the theme you want to activate and click the Activate button.

  • Visit the pages or posts on your WordPress website that were previously showing the 500 error. Verify if the issue is resolved. If the error disappears after switching to the default theme, it indicates a theme-related problem.
  • If the 500 error disappears with the default theme, there might be an issue with your original theme. Review the theme settings in the WordPress dashboard.
  • After identifying and resolving the issue, you can switch back to your original theme.

Cause 6: Incompatible PHP Version

Certain plugins and scripts require a specific PHP version for optimal functionality. If these requirements are not met, it can lead to the occurrence of the HTTP 500 Error.

To change the PHP version:

  • Log into your cPanel account.
  • Navigate to the Software and choose MultiPHP Manager.
  • Select the PHP version and click on Apply.

Cause 7: Restoring a Backup of Your Site

You can opt for restoration if you've created a backup of your operational WordPress site. The process involves removing all recent site files and then uploading the backup to your site.

Explore the utilization of WordPress functions like wp_insert_post and wp_update_post() to facilitate the process of re-uploading.

To generate and recover a backup using the All-in-One WP Migration plugin, follow these steps:

  • Log into your WordPress dashboard.
  • Navigate to Plugins > Add New plugin.

  • Search for the All-in-One WP Migration plugin.
  • Click on Install Now and Activate it.
  • Select the Backups tab and click on Create Backup.

  • Once the process is completed, download all the files.
  • To initiate a backup restoration, uninstall your existing website and install a fresh WordPress site with the All-in-One WP Migration plugin.
  • Then, utilise the Import feature to upload the backup saved on your computer, and follow the steps to complete the restoration process.

Cause 8: Check the error log

Checking the error logs is a crucial step in diagnosing and resolving issues on a website. The error logs provide information about errors and issues that occur during the execution of scripts or server processes.

  • Log in to your hosting account. Navigate to the control panel provided by your hosting provider.
  • Find and open the File Manager in your hosting control panel (Here are Steps for cPanel).
  • Locate the directory where your WordPress installation is stored. This is often named public_html or similar.
  • Go into the wp-content folder.

  • Check if a file named debug.log is in the wp-content directory.

If you can't find the debug.log file in the wp-content directory, there are a few additional steps you can take.

  • Look for the following lines:

define( 'WP_DEBUG', true );

define( 'WP_DEBUG_LOG', true );

define( 'WP_DEBUG_DISPLAY', false );

  • Ensure that these lines are present and set to true. If not, add them to enable debugging.
  • If the debug.log file is still not generated, create an empty file named debug.log in the wp-content directory.
  • Change the file permissions to allow WordPress to write to it.
  • Now Open the debug.log file using the File Manager's text editor or download it and use a local text editor.
  • Look for error messages or warnings that might provide information about the cause of the 500 Internal Server Error.
  • If you don't find useful information in the WordPress debug log, check the server's error logs. The location of these logs varies depending on your hosting environment. Look for files like error_log.

Contact your Web Host to Check Server Logs

You should contact your web host if no above-listed solution works for you. Web hosts can check the web server error logs and determine the exact cause of the ‘500 Internal Server Error'

If you faced the ‘500 Internal Server Error', let us know how you fixed it by dropping an email at [email protected].

Cause 9: Check File Permissions

File permissions determine who can read, write, and execute files on your server. If these permissions are set incorrectly, it can lead to various issues including the dreaded 500 error.

  • Login into your cPanel account.
  • Locate the File section and choose the File Manager.
  • Navigate to the root directory where WordPress is installed.
  • Right-click on the folder, and choose Permissions.
  • For folders like wp-admin and wp-content, set the permission level to 755.

  • Set the folder permissions to 755. This can usually be done by entering 755 in the numeric value field or by checking the boxes for read, write, and execute for the owner, and read and execute for the group and others.
  • Click on the change permissions button.

  • Now Similarly, right-click on the selected files, and choose the Permissions.
  • For files such as index.php, wp-config.php, and other core files, set the permission level to 644.

 

Conclusion

In conclusion, resolving a "500 Internal Server Error" in WordPress requires a systematic approach.
Whether dealing with corrupted .htaccess files, incompatible themes or plugins, PHP version issues, or WordPress updates, careful troubleshooting and identifying the root cause are essential.
Following the outlined steps, users can effectively address the error and restore their WordPress site to proper functioning.


Was this answer helpful?

« Back

chat