All posts

Blog

How to Fix a 500 Internal Server Error on Your Website

Illustrated cover for the Troubleshooting guide "How to Fix a 500 Internal Server Error on Your Website"

Few messages are as frustrating as "500 Internal Server Error." It shows up without warning, it gives visitors nothing useful, and it doesn't tell you, the site owner, what actually went wrong. All it really says is that the server ran into a problem it couldn't handle and gave up on the request.

The good news is that a 500 error almost always comes from a short list of causes, and you can work through them in a logical order. This guide explains what the error means, where to look first, and how to fix the most common culprits on a typical Linux hosting account.

What a 500 Internal Server Error actually means

Every time a browser asks for a page, the server answers with an HTTP status code. Codes in the 200 range mean success, 300s are redirects, 400s mean the request had a problem, and 500s mean the server itself failed.

The 500 code is the generic "something went wrong on our end" response. The web server (Apache, Nginx or LiteSpeed) passed the request along, usually to PHP or another application, and that step failed in a way the server couldn't describe more precisely. Because it's a catch-all, the code alone won't tell you the cause. The details are almost always written to an error log, which is why logs are your best friend here.

You may also see variations depending on the browser and server:

  • "500 Internal Server Error"
  • "HTTP Error 500"
  • "This page isn't working. example.com is currently unable to handle this request."
  • A completely blank page with a 500 status in your browser's developer tools

First, rule out the quick stuff

Before you start editing files, spend two minutes on these checks:

  1. Reload the page. Occasionally a 500 is a one-off caused by a brief overload or a process restarting. If a hard refresh fixes it and it never comes back, you may not need to do anything else.
  2. Check other pages. Is the whole site down, or just one page or the admin area? A single broken page points to something specific, like a plugin or script, while a site-wide error points to configuration.
  3. Think about what changed. Did you just install a plugin, update a theme, edit .htaccess, change PHP versions or upload new code? The most recent change is the prime suspect in the vast majority of cases.

Step 1: Read the error log

Rather than guessing, go straight to the evidence. On most hosting accounts you can find logs in a couple of places:

  • Your control panel's error log viewer. cPanel has an "Errors" page under Metrics that shows recent web server errors. DirectAdmin offers per-domain error logs.
  • An error_log file in your site folder. PHP often writes an error_log file into the directory where the failing script lives, such as public_html or wp-admin.
  • Server log files on a VPS. For Apache, look in /var/log/apache2/error.log or /var/log/httpd/error_log. For Nginx, check /var/log/nginx/error.log, plus your PHP-FPM log.

Look at the entries with timestamps that match when you loaded the page. Common messages include "PHP Fatal error," "Invalid command" (a bad .htaccess line), "Premature end of script headers," or "Permission denied." Each points to one of the fixes below.

Step 2: Check your .htaccess file

On Apache and LiteSpeed servers, a single bad line in .htaccess can take down an entire site with a 500 error. This is especially common after installing a security or caching plugin, or after copying rules from a tutorial.

To test it:

  1. Open your File Manager or connect by SFTP and go to your site's root folder.
  2. Make sure hidden files are visible, then find .htaccess.
  3. Rename it to something like .htaccess-old.
  4. Reload your site.

If the site comes back, the problem is inside that file. For WordPress, you can generate a clean one by going to Settings, then Permalinks, and clicking Save. For other apps, restore the default file from their documentation and add custom rules back one at a time until you find the line that breaks things. Our guide on fixing WordPress 404 errors and a broken .htaccess file shows what the default WordPress rules look like.

Step 3: Look for PHP errors

Many 500 errors are really PHP fatal errors in disguise. A plugin calling a function that doesn't exist, a syntax error in a file you edited, or code that isn't compatible with your PHP version can all stop a page dead.

Things to check:

  • Recent code edits. A missing semicolon or bracket in functions.php is enough to cause a 500. Undo the change or restore the file from a backup.
  • Plugins and themes. In WordPress, rename the wp-content/plugins folder to plugins-off. If the site loads, rename it back and disable plugins one by one (by renaming their individual folders) until the error returns. Do the same with your active theme if needed.
  • PHP version mismatch. If your host recently changed the default PHP version, or you did, older code may no longer run. Switching to a version your software supports often fixes it instantly. See how to change the PHP version for WordPress for the steps.
  • Memory limits. If the log mentions "Allowed memory size exhausted," the script needs more memory than PHP allows. Our article on the WordPress memory limit error covers this one in detail.

If the site shows a blank page or the "There has been a critical error" message instead, the process is similar. The white screen of death guide goes deeper on WordPress-specific debugging.

Step 4: Fix file and folder permissions

Linux servers are strict about who can read and execute files. Many hosts run PHP in a way that refuses to execute scripts with permissions that are too open, and the result is a 500 error.

Typical safe values are:

  • Folders: 755
  • Files: 644
  • Configuration files with passwords (like wp-config.php): 640 or 600, depending on your host

Never set files to 777. It's a security risk and on many servers it actually triggers a 500 error instead of fixing one. You can change permissions in your control panel's File Manager or with an SFTP client. On a VPS with SSH access, these commands reset a typical site folder:

find /path/to/site -type d -exec chmod 755 {} \;
find /path/to/site -type f -exec chmod 644 {} \;

Also check ownership on a VPS. Files uploaded as root may be unreadable by the user the web server runs as.

Step 5: Check for timeouts and resource limits

Sometimes a script runs too long or uses too many resources, and the server kills it. Signs include errors that happen only on heavy pages, imports, backups or checkout, and log entries mentioning timeouts or "resource limit reached."

Possible fixes:

  • Increase max_execution_time in your PHP settings if a legitimate task needs more time.
  • Break big imports or exports into smaller batches.
  • Look for runaway plugins, such as broken backup or statistics tools, that hammer the server.
  • If your site has simply outgrown its plan, a larger plan or a VPS may be the real answer.

Step 6: Restore from a backup

If you can't pinpoint the cause and the site needs to be back online now, restoring a recent backup is a perfectly valid fix. Restore files and, if needed, the database to the point just before the error started. Then reapply your changes carefully, testing after each one, so you can identify what broke it.

When to contact your host

If you've checked the log, ruled out .htaccess, disabled plugins, fixed permissions and the error persists, it's time to open a support ticket. Server-level problems, like a misconfigured PHP handler, a full disk or a crashed service, are things only your host can fix on shared hosting.

Give support the exact URL, the time the error happened, what you've already tried and any log lines you found. That information can turn a long back-and-forth into a quick fix.

Wrapping up

A 500 Internal Server Error looks scary, but it's usually caused by something ordinary: a bad .htaccess rule, a broken plugin, a PHP version mismatch or the wrong file permissions. Start with the error log, think about what changed most recently and work through the steps above one at a time. Once you're back up, keep regular backups and test updates on a staging copy so the next surprise is much easier to undo.