0

500 internal server error is shown when

i access http://mysite.com/cgi-bin/test.php

test.php

<p> title here</p>
<?php 

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
3
  • 1
    So, is there a question in here somewhere? Jan 31, 2010 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, 2010 at 14:37
  • 1
    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, 2010 at 21:15

1 Answer 1

2

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

You must log in to answer this question.