LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 04-24-2004, 06:02 PM   #1
bsdb3
LQ Newbie
 
Registered: Apr 2004
Posts: 2

Rep: Reputation: 0
Premature End of Script Headers (Error 500)


Hi I was wondering if anyone might be able to help me. I've recently set-up a Redhat Linux 9 server and installed apache. I'm doing some work in Perl and have successfully got scripts to work and tested with Mozilla.

The trouble I'm having is that I have some sites I've already created on an XP machine (sorry) and want to transfer them over. I FTP the files across (ASCII not binary transfer) and make sure they have the correct permissions but I get a 500 error - premature end of scripts. It's wierd because you copy the code and paste into a new file on the Red Hat server and it works fine. So I can only assume the permissions or something are getting messed up when they come across from XP?

If anyone could suggest any ways I could debug apache further or look at what might be wrong with the file permissions/ownership further I'd love to know,

cheers,

David
 
Old 05-03-2004, 09:54 AM   #2
mvierling
LQ Newbie
 
Registered: May 2004
Posts: 5

Rep: Reputation: 0
I did the same thing as you and was getting the exact same error. I put a "-w" on the #!/usr/bin/perl line to display any warnings and instead of displaying warnings, all my scripts work with the "-w" added. It doesn't make any sense.
 
Old 05-03-2004, 12:08 PM   #3
bsdb3
LQ Newbie
 
Registered: Apr 2004
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks

Thanks for the reply. The only other thing I would suggest checking when moving from XP to Redhat is making sure that the editor in XP you have been using has "Unix Line Endings" turned on.

cheers,

David
 
Old 05-04-2004, 04:20 AM   #4
redhatlover
LQ Newbie
 
Registered: Apr 2004
Posts: 27

Rep: Reputation: 15
Re: Premature End of Script Headers (Error 500)

Quote:
Originally posted by bsdb3
Hi I was wondering if anyone might be able to help me. I've recently set-up a Redhat Linux 9 server and installed apache. I'm doing some work in Perl and have successfully got scripts to work and tested with Mozilla.

The trouble I'm having is that I have some sites I've already created on an XP machine (sorry) and want to transfer them over. I FTP the files across (ASCII not binary transfer) and make sure they have the correct permissions but I get a 500 error - premature end of scripts. It's wierd because you copy the code and paste into a new file on the Red Hat server and it works fine. So I can only assume the permissions or something are getting messed up when they come across from XP?

If anyone could suggest any ways I could debug apache further or look at what might be wrong with the file permissions/ownership further I'd love to know,

cheers,

David
Hi bsdb3,
this problem happend by your ftp.
you need to edit vsftpd.conf

/etc/vsftpd
edit vsftpd.conf

look this line

#ascii_upload_enable=YES

change like this

ascii_upload_enable=YES

(restart vsftpd)


now upload your script files
 
Old 05-06-2004, 11:34 AM   #5
mvierling
LQ Newbie
 
Registered: May 2004
Posts: 5

Rep: Reputation: 0
I'm still getting this problem and I'm not transfering files via FTP. I have tried creating the script from scratch on the Linux server and copying the script from my Windows machine to the Linux machine via Samba. I always get the premature end of script headers message unless I add -w to the Perl line at the top. When I do that, the scripts run fine.
 
Old 05-06-2004, 11:55 AM   #6
mvierling
LQ Newbie
 
Registered: May 2004
Posts: 5

Rep: Reputation: 0
Update: Someone in another thread solved my problem. The problem was that each line of my script had a <CR> after it. This does not show up with the GEdit text editor I was using on my Linux server, but when I switched to the Nedit text editor, it showed the <CR>'s on each line. I deleted them all and removed the -w from the perl line at the top and the script ran fine!

Update #2: I found that even Nedit doesn't always show the ctrl-m characters, but if you open the file with Nedit then do a save as and save it with the same name as Unix format, it will remove the ctrl-m's that are causing the premature end of script headers error message.

Last edited by mvierling; 05-06-2004 at 12:57 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Premature end of script headers: CGI fatturi Linux - Newbie 4 07-19-2007 04:55 PM
Premature end of script headers bhomass Debian 1 12-02-2005 05:31 PM
python cgi script and premature end of script headers Neruocomp Programming 1 07-28-2005 11:43 AM
Premature end of script headers webhead Red Hat 5 09-22-2004 01:56 AM
Perl/CGI Problem "Premature Premature end of script headers: countdown.pl" newuser455 Linux - Software 2 07-18-2004 11:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration