500 Internal Server Error means something went wrong on the server — but the server won't tell the visitor what. It's the least informative error: it has dozens of possible causes. The good news is that the cause is almost always written in the logs and can be found in minutes. Here's what visitors can do and how site owners can find and fix the problem.
What a 500 error means
Code 500 is a generic server error: the request reached the site, but the application (PHP, Python, Node.js) or the web server couldn't process it because of an internal failure. Unlike 502 and 504, the problem isn't the link between the web server and the application but inside the application or its settings.
What to do as a visitor
- Reload the page after a minute — sometimes the error is temporary.
- Clear the site's cache and cookies or open it in incognito mode.
- If the error appears on every page, let the site owner know: a visitor can't fix it.
Common causes of a 500 error
| Cause | Typical sign |
|---|---|
| A PHP code error (syntax, calling a missing function) | "PHP Fatal error" in the log |
| A plugin or theme conflict (WordPress, Joomla) | the error appeared after an update or install |
| An invalid directive in .htaccess (Apache) | "Invalid command" or "RewriteRule" in error.log |
| PHP memory limit too low (memory_limit) | "Allowed memory size exhausted" |
| Wrong file and folder permissions | "Permission denied" in the log |
| Database connection failure | "Error establishing a database connection" / "Connection refused" |
| Script execution time exceeded | "Maximum execution time exceeded" |
How to fix a 500 error: step by step
Step 1. Find the cause in the logs
Connect to the server via SSH and check the latest log entries:
# Nginx
sudo tail -n 50 /var/log/nginx/error.log
# Apache
sudo tail -n 50 /var/log/apache2/error.log
# PHP-FPM
sudo tail -n 50 /var/log/php8.3-fpm.log
Look for lines with Fatal error, Permission denied or memory — they usually include the file and line number.
Step 2. Turn on error logging while debugging
For WordPress, add to wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Errors will be written to wp-content/debug.log. Turn debugging off once fixed.
Step 3. Check plugins and the theme
If the error appeared after an update, rename the wp-content/plugins folder via SFTP — all plugins will be disabled. If the site works, bring plugins back one by one to find the culprit. Do the same with the theme by temporarily switching to a default one.
Step 4. Check .htaccess (Apache)
Rename the .htaccess file in the site root. If the error disappears, it contains an invalid directive. In WordPress you can regenerate the default file under Settings → Permalinks.
Step 5. Raise PHP memory and execution time
# php.ini or the PHP-FPM pool
memory_limit = 256M
max_execution_time = 120
Restart PHP-FPM afterwards: sudo systemctl restart php8.3-fpm.
Step 6. Check file permissions
sudo chown -R www-data:www-data /var/www/site
sudo find /var/www/site -type d -exec chmod 755 {} \;
sudo find /var/www/site -type f -exec chmod 644 {} \;
Step 7. Check the database
sudo systemctl status mysql
sudo systemctl restart mysql
Verify the database name, user and password in the site config.
500 and related codes
| Code | Meaning |
|---|---|
| 500 | Internal application or server error |
| 502 | The gateway (Nginx) got an invalid response from the backend |
| 503 | Service temporarily unavailable: overload or maintenance |
| 504 | The backend didn't respond in time |
For details on 502, see our article "502 Bad Gateway Error: What It Means and How to Fix It".
How to reduce the risk of 500 errors
- Test plugin and CMS updates on a staging copy first.
- Back up before updating — rolling back then takes minutes.
- Watch server memory: with a constant lack of resources, errors become regular.
- Set up monitoring with Telegram alerts.
If your site has outgrown its current hosting, move it to a PSB Hosting VPS: dedicated resources, root access and full control over PHP and web server settings.
FAQ
Is a 500 error the host's fault or the site's?
Usually the site's: code, plugins, settings. Hosting problems typically show up as 502, 503 or the server being unreachable.
Does a 500 error affect search rankings?
A one-off doesn't. If search bots get a 500 for several days, pages may drop out of the index.
Why does the 500 error appear on only one page?
The failure is in code or data used only on that page: a template, a shortcode, a database query. Look for the log entry with the time you opened that page.









