HTTP Error 500 Internal server for php pages and solution

GIT – You get “500 – Internal error” error message when a user tries to access your Apache or Lighttpd based dynamic 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/message
=> /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:
=> /etc/php.ini
=> /chroot/etc/php.ini <– this file was missing

Many 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.

Print Friendly, PDF & Email



Bài viết liên quan

Be the first to comment

Để lại lời nhắn