I’m getting an Internal 500 Server Error
This article was posted in: Web Hosting
If you see an Internal Server Error (http status code 500) then something has gone seriously wrong. It might be our fault, but more often it's due something that's been misconfigured in your home directory. Common reason are:
Oops, you have a bug in your code
If PHP comes across a FATAL error that cannot be handled, then you will get a 500 error. If you are developing a website then this is probably your first stop on the bug-fix highway. Check your error_log files for clues.
Syntax error or disallowed directive in .htaccess files
.htaccess files are very sensitive things. You have to treat them with great care or they will bite! The quick and dirty (tried and true) way to work out where your error is, is to simply backup the file and then start hacking chunks of it out until the error goes away.
Common directives that Krystal do not allow in .htaccess files are
- FollowSymLinks - if you need to use this, please replace it with SymLinksIfOwnerMatch - it does the same thing but more securely.
- php_flag php_value php_admin_flag php_admin_value - do not use these in .htaccess, as they will give an error.
Wrong permissions have been set on a PHP script
If the Write bit is set for Other on a PHP file, then a 500 error will result. So, if the last digit of the file's three digit chmod is 7, 6, 3 or 2 then it's going to fail. This is a security feature of the suPHP environment we run. You don't want your PHP scripts to be writeable by just anyone!
PHP files should always be chmod 600, 640 or 644 (although 644 should not be used for scripts containing usernames or passwords.)
Wrong permissions have been set on public_html
It can be easy to accidentally alter permissions on files and directories. If the Write bit is set for Group or Other on this directory then a 500 error will result. The public_html directory should always be chmod 750.
Your account has exceeded it's allowed share of server resources
It is possible that because your account is exceeding it's allowed shared of the server's resources that your processes are either being delayed, or refused access to further memory. In some cases this can cause your website to produce errors. Please read the article - How to check your account's resource usage - for further information.