Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Premature end of script headers on Red Hat 9 with Apache

Status
Not open for further replies.

aMiSHBoB

Programmer
Jan 6, 2002
13
US
I had a linux box running Slackware 8.1 and the current Apache at that time. I have a bunch of perl scripts that I had running on there just fine. When I got my new box up and running with Red Hat 9 and the new version of Apache, I get that error of premature end of script headers when I try and run the perl scripts. I have tried uploading the files directly from linux box to box and still no go. I know that I have apache configured right and all the permissions configured right.

The strange thing is, when I open the file and then save it and close it. The file runs fine. I tried to run it at the command prompt before I opended it and saved it and it came back ok. But the only way that I can get my server to launch it in the browser is to open it and save it then try again.

I have even tried some commercial scripts off of the internet. I downloaded them with the Red Hat system and then installed them with that system and I get the same problem. It won't open untill I open the file with a editor and save it and then try it.

I am racking my brain with this crap. If anyone has any insight that would be awesome. I am trying to meet a deadline on getting the new server up and 3 sites launched and this is holding me back.

Thanks so much.

-- Chris
 
Does the ownership change when you open and save a file? I don't think it has anything to do with how you have apache configured since it works fine once you resave a file. I can't help myself but I wanna keep going back to the permissions. Some things to look for would be, who's the owner of a file when you upload it?, the uploader?, the directory's owner? or does it change when edited.
 
It isn't with the permissions because the same user that uploads it is the user that opens and saves it. The strange thing is that before I left today I got on the old linux server and uploaded it again and it worked fine. I don't know what the issue was, but I am glade it is working now.

Thanks

-- Chris
 
I guess I was wrong. I just went and downloaded a news manager script and it doesn't work. What I did was download it with the Red Hat machine and then unziped it right into the cgi-bin directory. I set all the permissions to 755. The owner of the file is that user name and the group it is assigned to is root. Once I open the file and save it without making any changes to it everything works fine. Is there some other group I should have it assigned to? I just figured that is the group it should be in since that is what the /var/ and all of its contents was before I added mine. I am really at a loss here.

The ScriptAlias settings I have in the httpd.conf are:

ScriptAlias /cgi-bin/ "/var/
Also I have this in the httpd.conf file:

<Directory &quot;/var/ Options ExecCGI

AllowOverride None
Allow from all


Order allow,deny
</Directory>

I don't know what else could be causing this problem. Thanks alot for all your help

-- Chris
 
The line, &quot;Order allow, deny&quot; should be before &quot;Allow from all&quot;. Let me go get a cup of joe and I'll keep working on this.
 
Are you sure the downloaded files are in true ascii format..I had similar probs until I ran dos2unix on the files which removes any ctrl characters etc which dont show up in the editor when checking the file.
If you have to open and save perhaps this is whats happening as it prob converts it as it saves it.
I have redhat 9 to, and if you open the file with the GNU emacs editor look to the grey bar running along the bottom of the screen where it gives the files name ,if it mentions dos..theres the prob.
 
I actually got it working over the week-end. Here is what the problem was. I downloaded the file in zip format. I thought it was tar.gz or .tgz. I just didn't really pay attention to that. Well, when opening it in Xwindows it didn't unzip it in ASCII. I had to go to a xterm and then use &quot;unzip -aa file.zip&quot; that was it will extract it in ASCII. After I did that and set the right permissions it worked. BTW, when I sent the sctipts from my old server to the new one through FTP it worked out fine.

-- Chris
 
I actually got it working over the week-end. Here is what the problem was. I downloaded the file in zip format. I thought it was tar.gz or .tgz. I just didn't really pay attention to that. Well, when opening it in Xwindows it didn't unzip it in ASCII. I had to go to a xterm and then use &quot;unzip -aa file.zip&quot; that was it will extract it in ASCII. After I did that and set the right permissions it worked. BTW, when I sent the sctipts from my old server to the new one through FTP it worked out fine.

-- Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top