Web Hosting Talk







View Full Version : Out of the goodness of your heart!!


GWDGuy
02-18-2003, 03:38 PM
I am trying to get a simple perl script to work and can't

Premature end of script headers: <<--- is in the log file

The path to perl is /usr/bin/perl and the first like in the script is
#! user/bin/perl

The permissions is set to 755
I FTP'd in ASCII mode (I double checked the FTP log)

What permissions should the actual CGI bin be?? Does that matter on this error.

Any help would be great..

Perl :smash: :stickout:

phobeas
02-18-2003, 04:00 PM
Is your perl script in your cgi-bin directory? also your cgi path seems incorrect according to your reference to path where perl is.
try changing "#! user/bin/perl " -> "#!/usr/bin/perl"

If that doesn't work try changing it to this :

#!/usr/bin/perl -w

If that doesn't work, try sending me the script at jason@nuphasix.com so I can make sure it isn't a problem with the script itself :D

Jason

Jim_UK
02-18-2003, 04:01 PM
Originally posted by GWDGuy
IThe path to perl is /usr/bin/perl and the first like in the script is
#! user/bin/perl

Was that a typo because going off what you said first, the top line of the script should be:


#!/usr/bin/perl


HTH :)

GWDGuy
02-18-2003, 04:05 PM
sorry there is no space in it :D
#!/usr/bin/perl

This is the ver top few line
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
$query = $ENV{'QUERY_STRING'**;
@pairs = split (/&/, $query);
foreach $pair (@pairs) {
($key, $value) = split(/=/, $pair);




I tried the -w and still got a 500 error.

:bawling:

phobeas
02-18-2003, 04:16 PM
can you try changing this line :
$query = $ENV{'QUERY_STRING'**;
to
$query = $ENV{'QUERY_STRING'**;

Not sure if this will fix your problem or not.

J

(whoops never mind, looks like that error was a thing the forum does :D)

GWDGuy
02-18-2003, 06:00 PM
I had the person that wrote the script look and this is what they get.. They could not get it to work on my server either.. I have lots of other Perl scripts working Yabb, Perl desk etc..

Premature end of script headers: /usr/local/psa/home/vhosts/thedomainname.com/cgi-bin/calculators.cgi
failed to open log file fopen: Permission denied

Robert

luxline
02-18-2003, 06:13 PM
Bloody amatuer perl programmers. Why dont they ever do things properly.

ok, IMMEDIATELY after the bang line
#/usr/bin/perl

put in this:

print "Content-type: text/html\n\n";

This is NOT going to fix the problem, BUT you should be able to get the error message showing up much better, and you wont get a premature end of script.

And tell the bloody programmer to write in some FAIRLY BASIC error checking routines before releasing it to the world. Using fatalstobrowser is pathetic.

And, if its a simple log file that cant be opened for reading/writing, tell the dumbo to put in
open(AFILE,">/blah/blah/blah") || &error("unable to open xyz.log");

and write a little error handling routine.

Schmutz

GWDGuy
02-18-2003, 09:32 PM
I added what you said and I get this.

syntax error at calculators.cgi line 4315, at EOF
Missing right curly or square bracket at calculators.cgi line 4315, at end of line
Execution of calculators.cgi aborted due to compilation errors.


I will dig some more..


<<<edit>>>> I found it... aarrgghhhh what a waste of a day, I will remember that debug tip

thanks everyone that helped on this

Robert