500 Internal Server Error (PHP)
PHP Programming Language
Severity: CriticalWhat Does This Error Mean?
A 500 Internal Server Error means something went wrong on the server, but the server is hiding the details from the browser. PHP is almost always the cause on a PHP-powered website. The real error message is being suppressed for security — but it is being written to the server's error log. The first step is always to find and read that error log.
Affected Models
- PHP 5.x
- PHP 7.x
- PHP 8.x
- All PHP versions
- WordPress
- Laravel
- Any PHP application
Common Causes
- A PHP fatal error that stopped the script — such as a syntax error, missing class, or out-of-memory condition
- A misconfigured or broken .htaccess file on Apache servers
- Wrong file permissions — PHP scripts need to be readable by the web server (typically 644)
- A PHP extension that is required by the application is not installed or enabled
- A plugin, theme, or library update that introduced a bug or compatibility issue
How to Fix It
-
Find and read the PHP error log. On Apache/cPanel, it is often at /home/username/public_html/error_log. On Nginx, check /var/log/nginx/error.log.
The log will show the real error message that the browser is hiding. This is the most important step.
-
Temporarily enable error display for debugging. Add these two lines at the very top of your index.php: ini_set('display_errors', 1); error_reporting(E_ALL);
Remove these lines before putting the site back in production. Never display errors to real users.
-
If you are using WordPress, disable all plugins by renaming the plugins folder temporarily. If the site loads, a plugin is the cause. Re-enable them one by one.
You can do this via FTP or your hosting file manager. Rename wp-content/plugins to plugins_disabled.
-
Check your .htaccess file for errors. Rename it temporarily to .htaccess_backup to test if it is the cause.
A single typo in .htaccess can cause a 500 error on Apache. If renaming it fixes the error, edit the file to find the problem.
-
Check file permissions. PHP files should be 644. Directories should be 755. Files set to 777 can cause 500 errors on some hosts.
Use your hosting panel's file manager or FTP client to check and correct permissions.
When to Call a Professional
If you cannot access the server error log and cannot find the cause, your web host's support team can check the logs for you. For production sites, a PHP developer should investigate and fix the root cause urgently. A live 500 error means your website is completely down.
Frequently Asked Questions
Why does the browser just show a blank page or 500 error instead of the PHP error?
PHP hides error details from browsers for security. Showing a detailed error message publicly could reveal your file structure, database names, or code logic to attackers. The real error is always in the server log. That is where you need to look first.
My site worked yesterday and now shows 500. What changed?
The most common causes of sudden 500 errors are: a PHP version upgrade, a plugin or theme update, a code change, or a server configuration change. Check your error log for the exact time the problem started. Compare it to any changes you made around that time.
Is a 500 error always a PHP problem?
Not always — but on PHP sites, it usually is. A 500 can also come from a misconfigured web server (Apache or Nginx), a bad .htaccess file, or a CGI script failure. The error log will tell you whether it is PHP, the web server, or something else.