Troubleshooting
500 Internal Server Error
Description of the problem
When I access my website or a file, the browser shows an error message headed "500 Internal Server Error".
Get the exact error
The 500 code doesn't identify the cause. Reproduce a single request and note down the URL and time. Then check cPanel > Errors and the PHP and application logs for that same moment. Don't turn on public error display on a production website.
Follow the branch that matches the logged message:
.htaccess
If the log mentions a directive that isn't allowed or a syntax error, fix the exact line in .htaccess. Don't rename or empty the whole file without keeping a copy, because it may contain security and application rules.
PHP or application
If a fatal error, an exception, exhausted memory or maximum execution time exceeded appears, use the message, the stack trace and the line shown to find the cause; that line may just be where the failure surfaced. A loop can end up as a 500, a 503 or a timeout depending on the environment; the HTTP code doesn't prove it on its own.
Permissions / chmod
On Hostsuar, normally use 755 for directories and 644 for files. 777 permissions are insecure, but only blame the 500 on permissions when the log shows a denial or a handler requirement. Also check the owner and traversal permissions of the parent directories.
If it started after a change
Link the first failure to an update, a PHP change or a deployment. Keep the previous file and configuration and test one fix at a time. Going back to a database backup may remove recent orders or changes: don't use it as a substitute for finding a faulty line.
Don't apply chmod recursively to the whole account; some private files need more restrictive permissions. Once you have fixed the cause, test the original URL and the operation that was failing, not just the home page. If you can't find a matching log entry, give support the time with time zone, the URL and the steps, without publishing stack traces that contain credentials or personal data.
You may also find useful
- Diagnose the 503 Overloaded error in PrestaShop Tell a PrestaShop 1.6 geographic block apart from maintenance mode and a server-generated 503 before...
- Internal server error when accessing email through Webmail Tell an internal Webmail error apart from a quota warning and check the mailbox, total disk space or...
- "An error occurred while sending the message" in the PrestaShop contact form Diagnose the contact form rejection and fix an old override only when it does not send contactform's...
- .eml files blocked by mail servers Diagnose the rejection of an .eml attachment from the exact SMTP event and offer alternatives, witho...
Something wrong or out of date? Tell us and we will review it.