How to fix HTTP error 500 in PHP?

Nov 23, 2022

Domantas G.

7min Read

How to fix HTTP error 500 in PHP?

Running into the 500 Internal Server Error in WordPress? Well, you’re not alone. 500 Internal Server Error or HTTP Error 500 is one of the most common issues WordPress webmasters encounter.

However, catching the cause behind this error is not as easy as some of the other commonly encountered HTTP errors. Here is a quick tutorial on fixing WordPress HTTP error 500 using 10 different methods. Let’s check it out.

How to fix HTTP error 500 in PHP?
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

  • Fixing 500 Internal Server Error WordPress
    • 1. WordPress 500 Internal Server Error Due to Bad Plugins
    • 2. WordPress 500 Internal Server Error Due to Themes Installation
    • 3. WordPress 500 Internal Server Error Due to Corrupted .htaccess File
    • 4. Insufficient PHP Limit
    • 5. Incompatible PHP Version
    • 6. Enabling Error Display
    • 7. Using WordPress Debugging
    • 8. Restoring a Backup of Your Site
    • 9. Re-uploading Core WordPress Files
    • 10. Contacting your Hosting Provider
  • What Causes the 500 Internal Server Error?
  • 500 Internal Server Error Variations

Fixing 500 Internal Server Error WordPress

Here are 10 different causes and solutions to fix WordPress 500 Internal Server Error:

Important! Before proceeding with this tutorial, we recommend making a backup of your site to prevent any file loss during the changes.

1. WordPress 500 Internal Server Error Due to Bad Plugins

In most cases, WordPress HTTP error 500 occurs because of a new plugin. If your page experiences issues after a new installation or update, then you can easily fix it by deactivating or removing the plugin.

There are two easy ways of doing this: through the WordPress dashboard or File Manager.

If you are still able to access WordPress from your hPanel, do so and select Plugins.

  1. You should see a list of Installed Plugins. From here, click on all of the green Active buttons and change all of the plugins to Inactive.
  2. One by one, make each plugin Active again and test your site after each one.
  3. If your site is fine, keep it Active. If you see the error, you know which plugin is causing the problem.
How to fix HTTP error 500 in PHP?

If you don’t have access to your dashboard, you can also disable or remove plugins through File Manager on your hosting control panel. Here we’re using Hostinger’s hPanel as an example:

  1. Login to Hostinger hPanel and navigate to File Manager under the Files area.
  2. Click on the public_html folder and select the wp-content directory.
    How to fix HTTP error 500 in PHP?
  3. Open the Plugins folder and locate the bad plugin. Then, right-click to Rename.
  4. Rename its directory by adding disabled after the plugin name to turn it off.
    How to fix HTTP error 500 in PHP?
  5. Finally, refresh your website to see if it works.

In case the problem persists, repeat the process until all plugins are deactivated or until your website is working again. Once you find out which plugin caused the server error 500, remove it completely and either reinstall it or try to find a substitute that performs the same.

2. WordPress 500 Internal Server Error Due to Themes Installation

A new theme or update is another common cause of HTTP status code 500. To fix it, simply change the existing theme to a new one or change it to one of the default options.

If you can access the WordPress admin area, try to change the WordPress theme.

Alternatively, you can also change themes by editing the MySQL database via phpMyAdmin in the control panel. Here’s how to do it with the hPanel:

  1. Navigate to phpMyAdmin in the hPanel.
  2. Once you open it, head to the wp_options table.
  3. Locate the template and stylesheet rows.
  4. Click Edit and change the template and stylesheet value with a default theme like Twenty Twenty, and press Go to save changes.

Now, reload your site with the new theme and see if it fixed the issue.

Important! To see a list of installed themes on your database that can be used to change the existing one, go to the wp-content/themes directory using File Manager.

3. WordPress 500 Internal Server Error Due to Corrupted .htaccess File

Another way to get rid of the server error 500 is to check your current .htaccess file and make sure that it’s not corrupted. However, you can also just create a completely new one. Here’s what you need to do:

  1. Open the File Manager and look for .htaccess in the public_html folder, then disable the file by giving it a different name.
    How to fix HTTP error 500 in PHP?
  2. Once it’s disabled, go on the upper part of the page and create a new .htaccess file.
  3. Right-click on the new file and select Edit.
  4. Copy-paste the default WordPress .htaccess code in the new one.
    How to fix HTTP error 500 in PHP?
  5. Click Save, and that’s it. You now have a brand new .htaccess file.

4. Insufficient PHP Limit

A memory limit or insufficient PHP value can be another reason behind the issue in WordPress, as scripts and plugins require a certain amount of memory to work.

To fix the memory limit, increase the PHP limit by editing the .htaccess file manually. Here are the lines that we recommend adding:

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

Once done, refresh your website. If your HTTP status code 500 is related to insufficient PHP values, this solution will fix the error.

5. Incompatible PHP Version

Some plugins and scripts require a specific PHP version to work properly. If the requirements are not met, the HTTP 500 Error may appear.

To change the PHP version via the hPanel, simply log in and head to the PHP configurations under the Advanced tab.

In case you don’t know what PHP version is needed, try upgrading or downgrading. Don’t forget to save the settings and refresh your website after each change.

How to fix HTTP error 500 in PHP?

If it still doesn’t fix the issue, change your PHP version to the initial one (which was used at the beginning) and proceed to the next option.

6. Enabling Error Display

Finding the reason for the WordPress 500 Internal Server Error is arguably the toughest part of fixing it. If none of the options above helped you, you might need to investigate deeper by enabling an error display that allows you to find and locate a specific issue on your site.

You can easily do so through the PHP Configuration section on your hosting control panel. Switch to the PHP Options and put a check on the display_errors and log_errors columns, then scroll down and Save. Once you refresh your site, it should display the specific.

How to fix HTTP error 500 in PHP?

Alternatively, you can also create a separate error log file and generate entries through the .htaccess file.

7. Using WordPress Debugging

If the step above didn’t work to fix the error in WordPress, it has its own special debugging system that you can use to troubleshoot issues. You can use it to generate an error log in the wp_content folder or to display the error 500 on your site when you access it. All you need to do is to enable the WordPress Debug feature.

8. Restoring a Backup of Your Site

In case you’ve backed up WordPress when it was functional, restoring the backup is also an option. All you need to do is remove all your recent site files and re-upload the backup to your site.

However, if you are not a fan of restoring WordPress backups manually, you can use a plugin. It won’t be much help if your site is not functional, but it can surely help avoid similar issues in the future.

To create and restore a backup through the All-in-One WP Migration plugin, follow these steps:

  1. Install and activate the plugin from the Plugin section.
  2. Then select the Backups tab.
  3. Choose Generate a new backup to export your files. Once the process is done, Download the exported files.
  4. To restore a backup, you will need to delete your current website and install a new WordPress site and the All-in-One WP Migration plugin.
  5. Then, select the Import feature and upload the backup stored on your computer and proceed with the restoration.
    How to fix HTTP error 500 in PHP?
  6. That’s it. Keep in mind that if your site needs more than a 512MB import size, you can upgrade and get unlimited upload and backup sizes by purchasing the plugin’s premium plan for a one-time price of $69.

9. Re-uploading Core WordPress Files

If nothing seems to go right, there is a more extreme option to fix the 500 error. You will be replacing all of the core WordPress files. Here’s how:

  1. Download the latest version of WordPress and unzip it on your computer.
  2. Go to the unzipped files and delete the wp-config-sample.php file and the wp-content folder to avoid overwriting any important data.
  3. Configure FileZilla, move all the WordPress core files to your site’s location, and overwrite the existing ones.
  4. Once a confirmation screen pops out, check the Always use this action and Apply to current queue only columns. That way, you won’t need to confirm the overwriting process for each file.
  5. That’s it. You just have to wait for the process to finish.

Important! Make sure that you already have a backup of your current website in case anything goes wrong.

10. Contacting your Hosting Provider

If at the end of the day, all the methods haven’t been successful and you still can’t solve the issue of the 500 error, then it’s time for some more help. Contact your web hosting customer success team and get some backup.

They will be able to check the server logs and locate the root cause of your issue.

What Causes the 500 Internal Server Error?

The most common reasons behind the Internal Server Error are corrupted .htaccess files, a new theme and or plugin, incompatible PHP version, or a WordPress update.

One of the best things to do when troubleshooting this error is to trace back your steps. Try remembering what specific event caused your site to stop functioning. When you know exactly what went wrong, find the best solution from the list.

500 Internal Server Error Variations

Since there are different web servers, browsers, and operating systems, the HTTP 500 error can appear in many ways. Here are a few variations that you’ll see:

  • 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

In addition to the list, you might see a blank white screen or a longer error message asking you to contact the server administrator.

It is becoming more common to have a custom 500 Internal Server Error page as well.

Conclusion

Most who use WordPress have encountered the HTTP error 500 WordPress problem. However, whether you’re an advanced developer, or a beginner, fixing the error is pretty easy if you know what to do.

Here’s a quick recap of the methods we’ve learned today:

  • Disabling a corrupted plugin through the WordPress Dashboard or File Manager.
  • Changing the WordPress theme to the default one through phpMyAdmin.
  • Increasing the memory limit and the PHP limit value via the .htaccess file.
  • Changing the PHP version to the latest one with the PHP Configurations tool on the hPanel.
  • Enabling the error display through the PHP Options.
  • Using the WordPress Debug.
  • Restoring a Backup of your site manually or with a migration plugin.
  • Re-uploading the Core WordPress files.

There you have it. The 500 Internal Server Error can be scary, but if you follow the steps we provided carefully, you’ll be able to fix the issue and access your site again in no time. Good luck!

Domantas leads the content and SEO teams forward with fresh ideas and out of the box approaches. Armed with extensive SEO and marketing knowledge, he aims to spread the word of Hostinger to every corner of the world. During his free time, Domantas likes to hone his web development skills and travel to exotic places.

How do I fix HTTP error 500?

How to Fix a 500 Internal Server Error.
Refresh the page. This might seem obvious, but if it's a temporary loading issue, you might find success if you refresh the page. ... .
Come back later. ... .
Delete your browser's cookies. ... .
Paste your URL into the website "Down for Everyone or Just Me.".

What causes 500 errors PHP?

If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules.

What causes an HTTP 500 error?

The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request. This error is usually returned by the server when no other error code is suitable.

Can T currently handle this request HTTP error 500 PHP?

The HTTP 500 message states that the server can't handle the request because of an unexpected condition. The problem may lie in browser cache, third-party themes and plugins, or PHP memory limit. It could also be due to a broken . htaccess file.