HTTP Status Codes

What Is HTTP 500 Internal Server Error?

HTTP 500 Internal Server Error means something went wrong on the server while processing a request. Learn what causes 500 errors, how to diagnose them, and how to fix them.

Last updated: Mar 28, 2026

HTTP 500 Internal Server Error is a generic server-side error. It means something went wrong on the server while processing the request, but the server cannot be more specific about what exactly failed. Unlike a 404 where the cause is clear — the page does not exist — a 500 is a catch-all error that can have many different underlying causes.

The important distinction from a 404 is where the problem lies. A 404 is a client-side error: the request was fine, the page just does not exist. A 500 is a server-side error: the request was fine, but the server failed to handle it.

What causes a 500 error?

Because 500 is a generic code, the causes vary widely. The most common ones are:

  • A bug in the application code. A PHP script, a Python application, a Laravel route, or any server-side code throws an unhandled exception. Instead of returning a page, the server returns a 500.

  • A misconfigured server. An error in the web server configuration — Apache, nginx, or similar — can cause requests to fail. A syntax error in an .htaccess file on Apache is a particularly common culprit and can take an entire website offline instantly.

  • A failed database connection. If the application cannot connect to the database — because credentials are wrong, the database server is down, or the connection limit has been reached — many requests will fail with a 500.

  • A timeout. If a script takes too long to execute and hits the server's maximum execution time limit, the server may return a 500 instead of waiting indefinitely.

  • Insufficient file permissions. If the server process does not have permission to read a file it needs — a configuration file, a template, a dependency — the request can fail with a 500.

  • Running out of memory. If a script exceeds the server's memory limit, it is terminated and a 500 is returned.

What visitors see

From a visitor's perspective, a 500 error looks similar to a 404 — they land on an error page and cannot access the content they wanted. The difference is that a 500 is usually temporary and fixable, while a 404 means the content is simply not there.

A well-configured website shows a custom error page for 500 errors that gives the visitor some indication of what happened and when to try again. A poorly configured one shows a raw server error with technical details — which is also a security risk, as error messages can reveal information about the server's software and configuration.

How serious is a 500 error?

A 500 on an internal URL is always serious. It means a page on your website is broken and visitors cannot access it. If it affects your homepage or a high-traffic page, it is effectively an outage.

A 500 on an external URL — a page on someone else's website that you link to — is less urgent. External servers have issues from time to time. It may resolve on its own. If it persists across multiple scans, it is worth removing or replacing the link.

500 vs other 5xx errors

The 5xx range covers all server-side errors. Some are more specific than 500:

  • HTTP 502 Bad Gateway means the server received an invalid response from an upstream server — common with reverse proxies and load balancers.

  • HTTP 503 Service Unavailable means the server is temporarily unable to handle requests, usually due to maintenance or overload.

  • HTTP 504 Gateway Timeout means an upstream server did not respond in time.

When a server encounters an error that does not fit any of these more specific codes, it falls back to 500. It is the last resort error code when the server knows something went wrong but cannot say what.

How to diagnose a 500 error

The first place to look is your server logs. Web servers log errors with details that are never shown to the visitor — the actual exception, the file and line number where it occurred, and a timestamp. On Apache the error log is typically at /var/log/apache2/error.log, on nginx at /var/log/nginx/error.log. Application frameworks like Laravel have their own logs — in Laravel, check storage/logs/laravel.log.

If you cannot access server logs directly, your hosting control panel usually provides access to error logs. Some hosting providers also send error notifications by email.

Once you have the actual error message from the logs, the cause is usually straightforward to identify and fix.

How to fix a 500 error

The fix depends entirely on the cause identified in the logs.

  • For a bug in application code, fix the exception and deploy the corrected code.

  • For a misconfigured .htaccess file, check the file for syntax errors. Even a single incorrect character can cause a 500 on Apache. If you recently edited the file, restore the previous version.

  • For a failed database connection, verify your database credentials, check whether the database server is running, and check whether the connection limit has been reached.

  • For a memory or timeout issue, optimize the code that is hitting the limit, or increase the limit in your server configuration if appropriate.

Finding 500 errors on your website

Like 404 errors, 500 errors can appear on pages that nobody visits regularly — older blog posts, less-used features, or pages deep in your site structure. A crawler that checks every URL on your website will surface these even if no visitor has reported them. dislike404.com includes 500 errors in its scan results alongside 404s and other issues, so you get a complete picture of what is broken on your website.