You get “500 – Internal server error” error message when a user tries to access your Apache or Lighttpd based dynamic php application (such as forum or blog software).
Generally, to solve this problem you need to take help of log files located at following location:
=> /var/log/httpd/error_logs (/var/log/lighttpd/error_log or /var/log/httpd/error_log)
So you may be wondering why your PHP script throws an Internal Server Error 500.
This error only occurs because of web server software. However after looking through logs you may not find many details. This problem may be caused by:
- A malformed php cgi script
- An invalid directive in an .htaccess or other config file
- Limitation imposed by file system and server software (for example php log file size set to 10Mb)
- Missing php.ini (or cannot read php.ini file)
In most case it is an invalid .htaccess directive. However recently I came across a web server w/o /etc/php.ini file. A long time ago I setup this server )Apache chrooted jail). So you need to maintain two files one outside jail and another inside jail:
=> /chroot/etc/php.ini <-- this file was missingMany scripts open this file on fly to get correct configuration directives. If this file not found you get error 500. It took some time to figure out this problem. Finally strace helped me out to debug this problem.For me it was another day with another interesting problem ;)