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
  • 1
    So, is there a question in here somewhere? – Michael Graff Jan 31 '10 at 08: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
  • 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 09 '10 at 21:15

1 Answers1

2

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

Fahad Sadah
  • 1,496
  • 11
  • 21