ircmaxell

Member
Mar 20, 2006
14
0
151
I've got 2 cgi files in my cgi-bin that will not run via http (they run fine command line). I cannot get ANY cgi files to run in cgi-bin via http...
http://www.bigtrue.com/cgi-bin/header.cgi (a php based script)
http://www.bigtrue.com/cgi-bin/header2.cgi (a perl based script)

They are as simple as can be, but just won't run. I keep getting a 500 error. When looking at the logs, Premature End Of Script Headers. I've checked permissions, file type (unix vs windows linefeeds), syntax, spaces, etc... I am totally lost!
Header.cgi :

#!/usr/local/bin/php
<?php
echo 'Content-type: text/html'.chr(10);
echo 'HTTP/1.1 200 OK'.chr(10);
echo '';
echo 'TEST!';
?>
Header2.cgi

#!/usr/local/bin/perl
print 'Content-type: text/html\n\n';
print 'THIS IS A TEST';
for the php script, I also tried using the header() function, with the same results...
 

WebScHoLaR

Well-Known Member
Dec 14, 2005
508
3
168
Planet Earth
Have you checked the error that Apache is reporting while executing these scripts? You can check the apache error log at /usr/local/apache/logs/error_log but it requires root access.
 

ircmaxell

Member
Mar 20, 2006
14
0
151
WebScHoLaR said:
Have you checked the error that Apache is reporting while executing these scripts? You can check the apache error log at /usr/local/apache/logs/error_log but it requires root access.
Yes I have... All it says is "Premature End Of Script Headers"...
 

ircmaxell

Member
Mar 20, 2006
14
0
151
Well, I created them in VI, and they do have permissions of 755. I assume that VI defaults to ASCII. This is why I am lost...
 
R

remik

Guest
ircmaxell: have You solved the problem? I have the same thing on 2 of my servers.
Bash scripts don't run either. I have noticed that compiled ELF executables run just fine..
 

brunomenoli

Active Member
Sep 2, 2005
28
0
151
Brazil
My problema ix fixed,

The permissions files cannot be 777, I set 755 is works> See the file:



/usr/local/apache/logs/suexec_log