Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
1  
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
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 '10 at 21:15

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

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