Server Error
500

Internal Server Error

The server encountered an unexpected condition that prevented it from fulfilling the request.

# Quick Definition

The server encountered an unexpected condition that prevented it from fulfilling the request. It's a generic catch-all error when no more specific server error applies. Think of it as the server saying "something broke, but I'm not sure what."

# When Does a 500 Error Occur?

A 500 Internal Server Error is returned when server-side code throws an unhandled exception, configuration is corrupted, or a critical resource is unavailable. Unlike more specific 5xx codes, a 500 is the default fallback when the server knows something went wrong but can't categorize the error more precisely.

This is the most common server error you'll encounter. It can originate from any layer of your application stack -- web server configuration, application runtime, database layer, or even filesystem issues.

# Common Causes

# How to Fix a 500 Error

  1. Check server error logs -- Apache: /var/log/apache2/error.log, Nginx: /var/log/nginx/error.log. The log entry will contain the specific error message and stack trace.
  2. Review recent deployments or code changes -- If the error started after a deploy, roll back to the last known working version and inspect the diff.
  3. Verify file permissions -- Files should be 644, directories should be 755. Incorrect permissions are a common cause, especially after deployments.
  4. Check .htaccess for syntax errors -- A single typo in your .htaccess file can cause Apache to return a 500 for every request. Temporarily rename it to test.
  5. Test database connectivity -- Use a simple script or CLI tool to verify your application can connect to the database with the configured credentials.
  6. Verify PHP/Node.js memory limits -- Check memory_limit in php.ini or --max-old-space-size for Node.js. Increase if processes are being killed.
  7. Disable recently added plugins/modules -- If you're running a CMS like WordPress, disable plugins one by one to isolate the culprit.
  8. Check disk space -- Run df -h to verify sufficient disk space. A full disk prevents logging, temp file creation, and session storage.

# HTTP Example

Request
GET /api/users HTTP/1.1
Host: example.com
Accept: application/json
Response
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Date: Thu, 20 Feb 2026 12:00:00 GMT

{
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}

# Related Status Codes

# Frequently Asked Questions

Is a 500 error my fault? +
No, a 500 Internal Server Error is a server-side issue. It means something went wrong on the server while processing your request. As a visitor, there's nothing you did wrong. The website's server administrator needs to investigate and fix the problem.
How do I find the cause of a 500 error? +
Check your server error logs. For Apache, look at /var/log/apache2/error.log. For Nginx, check /var/log/nginx/error.log. Application-level logs (PHP, Node.js, Python) will often contain the specific exception or stack trace that triggered the 500 error. Enable detailed error reporting in development environments for easier debugging.
Can a 500 error fix itself? +
Sometimes, yes. If the 500 error is caused by temporary resource exhaustion (like running out of memory or disk space), it may resolve once resources free up. However, most 500 errors require manual investigation and a code or configuration fix. Setting up monitoring can help you catch these errors early.

Get alerted before your users notice

Monitor your website 24/7 and receive instant alerts when 500 errors occur.

Start Free Monitoring