[Gllug] perl & cgi glitches

gllug at uncertainty.org.uk gllug at uncertainty.org.uk
Sat Dec 22 11:08:18 UTC 2001


On Sat, Dec 22, 2001 at 09:27:25AM +0000, Xander D Harkness wrote:
> I have tried both /usr/bin/perl and /usr/local/bin/perl
> 
> the script works if I run it on ethe command line..
> 
> I also have FormMail.pl on the same system which works.
> 
> I have tried the same scripts on another system here with the same
> error.
> 

it will run fine on the command line - the problem is that apache is
expecting the cgi script to output headers, followed by a blank line -
and then content.

This script only outputs one line of text and exits without any newline 

the line in the logs 'premature end oif script headers' means tha apache
is objecing that it didn't even get the doble newline that signifies end
of headers.


the script will probably run fine if you insert 

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

as the first print statement.

Sean
 

> Cheers
> Xander
> 
> On Sat, 2001-12-22 at 06:57, Pete Ryland wrote:
> > On Sat, Dec 22, 2001 at 05:45:35AM +0000, Xander D Harkness wrote:
> > > I have a friend who wants to run cgi scripts on one of my boxes.
> > > 
> > > The script will not run even though I am told it will run on his
> > > configuration.
> > > 
> > > I get the following error:
> > > 
> > > [Sat Dec 22 05:14:00 2001] [error] (2)No such file or directory: exec of
> > > /home/ukadis/htdocs/cgi-bin/test_one.pl failed
> > > [Sat Dec 22 05:14:01 2001] [error] [client 213.48.46.210] Premature end
> > > of script headers: /home/ukadis/htdocs/cgi-bin/test_one.pl
> > > 
> > > The script is :
> > > 
> > > #!/usr/local/bin/perl
> > 
> > On most systems (well at least most linux systems) these days, the perl
> > binary is installed at /usr/bin/perl rather than /usr/local/bin/perl.
> > 
> > Pete
> > 
> > > print "<HTML>";
> > > print "<HEAD>";
> > > print " <TITLE>test</TITLE>";
> > > print "</HEAD>";
> > > print " <BODY TEXT = BLUE BGCOLOR = WHITE>";
> > > print " Test perl scripts";
> > > print "</BODY> </HTML>";
> > > 
> > > 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 274 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20011222/813a8df8/attachment.pgp>


More information about the GLLUG mailing list