Gossamer Forum
Home : General : Perl Programming :

Premature end of script error

Quote Reply
Premature end of script error
I have read a similar post topic but the resolution seems somewhat different than what I need to do to correct the problem.

I am on a windows98 machine working with Notepad to edit my scripts. I have even copied the text directly into the editor on the server from Notepad but I keep getting...

Premature end of script headers: /hsphere/local/home/melissa/latinmusicartists.com/cgi-bin/classad.pl

whether I use .pl or .cgi extension and set permissions to 755. The server is enabled for both extension types. Yes I re-edited the script to point to .pl or .cgi respectively.

All files resides in the root of cgi-bin.

I even tried removing the 5 from the perl path which means I tried both ways.

My ftp utility is ws_ftp95LE

I placed the scripts here for viewing so if anyone can help it will be more than appreciated.

Thanks
Dave

www.latinmusicartists.com/classad.txt

www.latinmusicartists.com/db-lib.txt

Also the url to the script is

www.latinmusicartists.com/cgi-bin/classad.pl
Quote Reply
Re: [davetech] Premature end of script error In reply to
The first thing I notice is that these should be forward slashes...

Code:
require "\hsphere\local\home\melissa\latinmusicartists.com\cgi-bin\db-lib.cgi";
$pagetitle="LMA Classifieds";
$data_file="\hsphere\local\home\melissa\latinmusicartists.com\cgi-bin\datafile.txt";
$item_file="\hsphere\local\home\melissa\latinmusicartists.com\cgi-bin\item.txt";
Quote Reply
Re: [davetech] Premature end of script error In reply to
If you have telnet access to your host, go to the directory where the script is and type

perl -c scriptname.cgi

That should give you a list of errors.

1. You need to comment out comment lines like

- Absolute path to the CGI directory/db-lib file

i.e. add a # at the beginning of the line

2. paths should contain forward slashes, e.g /hsphere/local/....

I haven't look further than 'Do not edit below this line', assuming the script was fine from there.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Premature end of script error In reply to
Ok I made those corrections but still the same error.

I have not setup telnet. I only viewed server's error log.

Thanks
Dave
Quote Reply
Re: [davetech] Premature end of script error In reply to
Create a simple test script to see if that works. A "Hello World" type script will do.
Quote Reply
Re: [Paul] Premature end of script error In reply to
Not a problem. My other scripts run fine there.

Dave
Quote Reply
Re: [davetech] Premature end of script error In reply to
Hello davetech

When I started writing perl scripts on windows and ftp'ing them to linux

I found many 500 errors , but the script worked in windows.

I then bought Edit Plus editor which allows me to save in unix/windows format a file.

Unix / Linux use different carriage returns / line feeds characters than Windows does.

Is this your error ?

cornball
Quote Reply
Re: [cornball] Premature end of script error In reply to
Yes I've heard of Edit Plus. Not quite the problem though.

Thanks
Dave
Quote Reply
Re: [davetech] Premature end of script error In reply to
Hello dave tech

why do you not add :

use CGI::Carp qw(fatalsToBrowser);

to the top of your script so you can get an error messge back in the browser

for www.latinmusicartists.com/cgi-bin/classad.pl

instead of the generic error 500 message.

Remember to comment out this after it works as it may give messages to hackers.

Thanks

Cornball

Sorry I do not have the system and bits to fully try out your code.
Quote Reply
Re: [cornball] Premature end of script error In reply to
Just got lazy that's all.

Will do on next test.

Thanks
Dave
Quote Reply
Re: [davetech] Premature end of script error In reply to
Quote:
Yes I've heard of Edit Plus. Not quite the problem though.

How do you know it's not the problem?

Quote:
Just got lazy that's all.

Perhaps we should all get lazy then and relax whilst you do some more debugging Cool

Last edited by:

Paul: Mar 16, 2003, 2:13 AM