Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

500 internal server error is shown when

i access


<p> title here</p>

echo "hi";


error log shows

(8)Exec format error: exec of '/var/www/cgi-bin/test.php' failed'. 
Premature end of script headers: test.php.

solved it by adding

            AddHandler application/x-httpd-php .php
share|improve this question
So, is there a question in here somewhere? – Michael Graff Jan 31 '10 at 8:37
Hey VVVVVV. Clear up the confusion by Answering and Accepting your answer below in the Answer section. Otherwise I'm with MGraff... what's the question? – Patrick R Jan 31 '10 at 14:37
php is not cgi(unless you are using the php cgi for some reason, which you are not). You shouldn't be putting .php files in cgi-bin. – Justin Mar 9 '10 at 21:15

You need the AddHandler statement, otherwise the script is executed as CGI, rather than PHP.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.