Fixing 500 Internal Server Error in PHP

Are you facing the 500 internal server error in PHP? This can be due to a momentary server issue, or an issue with your browser cache.

However, corrupt plugins or themes can also cause the problem. Try updating them, and if this doesn’t help, disable them.

I’ve faced this issue a couple of times on the B2B site I used to run. Thankfully, the troubleshooting tips discussed below helped each time. Keep reading to find out more or read our black screen error page.

Fix 1: Reload the Page

A simple fix like reloading the page might help. The problem may be due to a momentary server issue.

Fix 2: Clear Browser Cache

Did the reload not fix the problem? Try clearing your browser’s cache.

Here’s what you need to do:

  • Open your browser settings
  • Go to browser history
  • Clear cache

Fix 3: Give Debugging a Try

Let’s move on to more comprehensive fixes. First off, debugging:

  • Add the following lines to your index.php file:  ini_set(‘display_errors’, 1); ini_set(‘display_startup_errors’, 1); error_reporting(E_ALL);
  • Download the WP-congif.php file if you have a WordPress website; you will find it in your root directory. Open it in any text editor of your choice, and then check for the WP_DEBUG string.
  • Change the line from FALSE to TRUE if you see it, and then upload it again.
  • Reload the site. You should see a fatal error text that directs to you a file’s line of code.

This line of code will fix the issue if the server error was due to a code problem. It may have popped up because of a bad plugin or theme. Disabling or updating them will help.

Be sure to change the TRUE value back to FALSE when you are done.

Fix 4:  Empty .htaccess File

An empty .htaccess file can also cause the problem. These rules should help:

# BEGIN WordPressRewriteEngine On RewriteRule.* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]# END WordPress

You will have to connect remotely to your server to do this. Use SSH/SFTP.

Fix 5: Debug .htaccess

Are you still having trouble? Debugging your .htaccess file might help. The rules that direct to modules may not have been installed properly.

Also, recursive rewrite rules in the file can cause the issue.

Fix 6: Replace Core Files

Corrupted core files could also be responsible. Fix them by uploading updated core files via an FTP server. Fillzilla would be a good choice.

Fix 7: Remove DNS Entries

Check whether your DNS is pointing to a server that’s not your host one. The easiest way would be to download a DNS record tool. There are many on the market, but a personal favorite is All you have to do is enter your domain name into the tool’s search function.

Fix 8: Update PHP Version

You may be using a PHP version that’s not supported by WordPress. Update to versions 7.0, 7.1, 7.2, 7.3 or 7.4. Most WordPress hosting sites come with all the latest updates, so this won’t be difficult.

Fix 9: Increase PHP Memory Limit

PHP libraries need a memory limit to properly execute scripts. The issue can be due to a low memory limit. Increase it and see if this helps.

You probably have a memory limit defined in the app configuration file. Increase the value you’ve included.

You don’t have to worry about the Allowed Memory Size error from ever popping up once you’ve increased the limit.

Fix 10: Move to an Older Version

A last resort would be to revert back to the last available version of your website. You would be able to get rid of the 500 error but this won’t lead you to the exact cause.

Fix 11:  Hosting Team

Contact your web hosting provider for help. The error might be due to an internal problem. Hopefully, they will able to tell you when it will be fixed.

Switching to another web host might be a good idea if your web host regularly faces issues.

What Does Bandwidth Limit Exceeded Mean?

Final Thoughts

The error can pop up due to various reasons, as discussed above. Most of the time, it’s because of a simple issue like a random server glitch or your browser cache acting up. Sometimes, it can be due to a more complex problem like a corrupt file or a plugin and theme being outdated. It’s easy to rule out whether a plugin or theme are responsible, as you can just disable the two. If the server error still pops up, you know they are not responsible.

If you have tried everything but are still having trouble, either revert any recent changes you made or contact your web hosting company. There’s a chance that they may be facing an internal issue, and you will get it fixed.