Thursday, January 20, 2011

500 internal server error running php file in cgi-bin

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
  • You need the AddHandler statement, otherwise the script is executed as CGI, rather than PHP.

    From fahadsadah

0 comments:

Post a Comment