
The 500 Internal Server Error is the most generic server error there is. It basically means "something went wrong on the server, but we're not going to tell you what." That vagueness makes it frustrating — but there are only a handful of common causes, and the fix is almost always in your server logs.
A 500 error means the server encountered an unexpected condition that prevented it from fulfilling the request. Unlike a 502 or 504 which point to communication between servers, a 500 is an error on the server itself.
It's a catch-all. Any unhandled exception in your application, any broken server configuration, or any permission issue can produce one. The HTTP response itself doesn't tell you the cause — that information is in your logs.
This is always step one with a 500 error. The server knows exactly what went wrong — it just doesn't show it to the browser for security reasons.
# Nginx
sudo tail -f /var/log/nginx/error.log
# Apache
sudo tail -f /var/log/apache2/error.log
# PHP errors (often separate from web server logs)
sudo tail -f /var/log/php/error.log
Also check your application's own logs if it has them. Laravel, Django, WordPress, and most frameworks write their own error logs with much more detail than the web server log.
Unhandled PHP exceptions, fatal errors, or syntax errors in your code (or a plugin/theme) cause a 500 on PHP sites. If PHP crashes processing a request, the server returns 500.
Enable PHP error display temporarily in development:
ini_set('display_errors', 1);
error_reporting(E_ALL);
Never do this in production — it exposes sensitive information. Use logs in production instead.
An invalid directive in your .htaccess file will cause Apache to return 500 immediately. This often happens after:
.htaccess from a different serverTest: Rename .htaccess to .htaccess.bak temporarily. If the 500 goes away, the problem is in that file. Restore it and remove the bad line.
Web server processes run as a specific user (often www-data). If files or directories have permissions that prevent this user from reading them, a 500 can result.
Correct permissions for most web apps:
# Files: 644, Directories: 755
sudo find /var/www/yourapp -type f -exec chmod 644 {} \;
sudo find /var/www/yourapp -type d -exec chmod 755 {} \;
Never set permissions to 777 on a production server.
If a PHP process tries to use more memory than allowed, PHP kills it with a fatal error and the server returns 500. You can increase the memory limit in php.ini:
memory_limit = 256M
Or in WordPress's wp-config.php:
define('WP_MEMORY_LIMIT', '256M');
If application core files are missing, truncated, or corrupted (sometimes after a bad deployment or a failed file transfer), the app can't boot and throws a 500.
Re-deploying a clean version of the application files usually fixes this.
Many frameworks throw a 500 if they can't connect to the database at startup. Check your database credentials in your config file and confirm the database server is running and accessible.
Long-running PHP scripts that exceed max_execution_time are killed and produce a 500. Increase the limit for scripts that legitimately need more time, or move the work to a background job.
WordPress sites are particularly prone to 500 errors after plugin or theme updates. When you can't access the admin panel:
Deactivate all plugins by renaming the /wp-content/plugins/ folder via FTP or SSH to /wp-content/plugins.bak/. If the site loads, a plugin is the cause — rename the folder back and activate plugins one by one to find the culprit.
Switch to a default theme by renaming your active theme folder. This rules out a theme causing the crash.
Increase WP memory limit in wp-config.php as described above.
Some 500 errors are caused by code bugs — those need fixing at the source. But infrastructure-related 500s (permissions, memory, config) can often be caught earlier:
Domain Monitor will alert you the moment your site starts returning 500 errors, with enough context to start diagnosing straight away.
Generative AI creates new content — text, images, code, and more. This guide explains how it works, what tools are available, and where it's genuinely useful versus overhyped.
Read moreCursor AI is an AI-powered code editor built on VS Code. Learn what it does, how it works, and whether it's the right tool for your development workflow.
Read moreClaude Opus is Anthropic's most capable AI model, built for complex reasoning and demanding tasks. Learn what it does, how it compares, and when to use it.
Read moreLooking to monitor your website and domains? Join our platform and start today.