500 HTTP Origin: Network Last updated 15 Oct 2026

HTTP 500 Internal Server Error

The server hit an unexpected condition — usually an unhandled exception or misconfiguration in the application.

Exact message you may see internal server error500 Internal Server Errorserver errorHTTP ERROR 500The server encountered an internal error

Meaning

A 500 is a generic “something broke on the server” response. The client usually can’t fix it; the real reason is in the server or application logs. In production, frameworks hide details for security, so the first step is always to find the log entry for the failing request.

Common causes

  • Unhandled exception in application code
  • Syntax error or fatal error (PHP) after a deploy
  • Invalid .htaccess directive (Apache returns 500 for unknown directives)
  • Database connection failure or failed query
  • Missing environment variables / config after deploy
  • File permission problems on cache, logs or upload folders
  • Exhausted memory or execution time limits

⚡ Quick fix

  1. Check the application log and web server error log at the timestamp of the request
  2. Temporarily enable detailed errors in a non-production environment
  3. Roll back the last deploy if the error started right after it
  4. Verify environment variables, DB credentials and writable folders
  5. Rename .htaccess temporarily to test whether it’s the cause

Detailed fix by platform

Apache

  1. Check error_log for "Invalid command" (missing module) or "RewriteRule: bad flag".
  2. Enable the required module (sudo a2enmod rewrite headers) or remove the directive.

Nginx

  1. Nginx itself rarely produces 500; look at the upstream app (PHP-FPM, Node, Python) logs. Also check /var/log/nginx/error.log for rewrite cycles.

PHP

  1. Log everything, display nothing in production:
    ini
    display_errors = Off
    log_errors = On
    error_log = /var/log/php/error.log
    error_reporting = E_ALL
  2. Laravel: check storage/logs/laravel.log; ensure storage/ and bootstrap/cache/ are writable.

Node.js

  1. Wrap async route handlers so rejected promises reach your error middleware; log err.stack.

WordPress

  1. Set define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); and read wp-content/debug.log.

Code examples

Find the error for a request

bash
sudo tail -f /var/log/nginx/error.log /var/log/php*-fpm.log
journalctl -u myapp -n 100 --no-pager

How to diagnose

  1. Reproduce — Does it fail every time or intermittently?
  2. Logs — App log + server error log at the same timestamp
  3. Recent change — Deploy, config, dependency or data change?
  4. Dependencies — Database, cache, external API reachable?
  5. Resources — Memory, disk, permissions OK?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

500.30 — HTTP Error 500.30 - ASP.NET Core app failed to start (.NET)500.30501 — HTTP 501 Not Implemented (HTTP)501502 — HTTP 502 Bad Gateway (HTTP)502503 — HTTP 503 Service Unavailable (HTTP)503504 — HTTP 504 Gateway Timeout (HTTP)504506 — HTTP 506 Variant Also Negotiates (HTTP)506507 — HTTP 507 Insufficient Storage (HTTP)507508 — HTTP 508 Loop Detected (Resource Limit Is Reached) (HTTP)508500

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.