500 Error: Causes & Diagnosis

Understand and resolve the most common server error.

The 500 Internal Server Error is frustrating because it says nothing about the actual cause. It's a generic message indicating an unhandled exception occurred server-side.

The key is to check server logs that contain the detailed error. This guide shows you where to look and how to fix the most common causes.

Main Causes

  • PHP/Python/Node error: An uncaught exception in application code crashes the request.
  • File permissions: Web server cannot read or execute certain files.
  • Invalid .htaccess: Syntax error or unsupported directive in .htaccess.
  • Insufficient memory: Script exceeds memory_limit and is killed by PHP.
  • Missing module: Code uses a PHP extension or dependency that isn't installed.

Diagnosis

  • Server logs: Check /var/log/apache2/error.log or /var/log/nginx/error.log depending on your server.
  • PHP logs: Check the PHP error_log file defined in php.ini.
  • Debug mode: Temporarily enable display_errors in development to see exact error.

Solutions

  • Fix the code: Once error identified in logs, fix the bug in code.
  • Fix permissions: Files at 644, folders at 755, owner www-data (or equivalent).
  • Regenerate .htaccess: Delete .htaccess and let CMS regenerate it, or fix the syntax.

Frequently Asked Questions

Why do I just see "500 Internal Server Error" with no details?

It's intentional in production to not expose sensitive information. Details are in server logs.

Is 500 error always a code bug?

Not always. It can be permissions, broken .htaccess, or missing module. Logs give the real cause.

How to be alerted of 500 errors?

MoniTao monitors HTTP code and alerts you immediately on 500 errors.

Does 500 error affect SEO?

Yes, if it lasts. Google sees 500s and may demote the page. Resolve quickly.

Ready to Sleep Soundly?

Start free, no credit card required.