IIRC, 

print "Content-type: text/html\n\n";
needs to be right under
#!/usr/bin/perl
like: 

#!/usr/bin/perl
print "Content-type: text/html\n\n";
# hello.pl -- my first perl script!


HTH  
Dave  


Mithrilhall2000 said onto me:  

Mithrilhall2000> Here is the sample script I am trying to execute:
Mithrilhall2000> 
Mithrilhall2000> #!/usr/bin/perl
Mithrilhall2000> # hello.pl -- my first perl script!
Mithrilhall2000> print "Content-type: text/html\n\n";
Mithrilhall2000> 
Mithrilhall2000> This is what I get running it from shell:
Mithrilhall2000> 
Mithrilhall2000> [eric@Mithrilhall cgi-bin]$ ls -lh
Mithrilhall2000> total 48k
Mithrilhall2000> -rw-r--r--    1 apache   apache        268 Oct 17 15:09 printenv
Mithrilhall2000> -rwxr--r--    1 root     root          788 Mar 28 22:16 script.cgi*
Mithrilhall2000> -rw-r--r--    1 apache   apache        757 Oct 17 15:09 test-cgi
Mithrilhall2000> -rwxr-xr-x    1 root     root          216 Mar 28 14:34 test.cgi*
Mithrilhall2000> -rwxr-xr-x    1 eric     eric          20k Mar 27 23:48 wwwboard.pl*
Mithrilhall2000> -rwxr-xr-x    1 root     root          102 Mar 31 02:08 x2.cgi*
Mithrilhall2000> -rwxr-xr-x    1 root     root           92 Mar 29 00:19 x.cgi*
Mithrilhall2000> [eric@Mithrilhall cgi-bin]$ perl x.cgi
Mithrilhall2000> Content-type: text/html
Mithrilhall2000> 
Mithrilhall2000> [eric@Mithrilhall cgi-bin]$
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> When trying to run it from the browser this is how I call it:
Mithrilhall2000> 
Mithrilhall2000> http://mithrilhall.redirectme.net/cgi-bin/x.cgi
Mithrilhall2000> 
Mithrilhall2000> This is the result in the browser:
Mithrilhall2000> 
Mithrilhall2000> Internal Server Error
Mithrilhall2000> The server encountered an internal error or misconfiguration and was
Mithrilhall2000> unable to complete your request.
Mithrilhall2000> Please contact the server administrator, root@localhost and inform 
them
Mithrilhall2000> of the time the error occurred, and anything you might have done that
Mithrilhall2000> may have caused the error.
Mithrilhall2000> 
Mithrilhall2000> More information about this error may be available in the server error
Mithrilhall2000> log.
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> 
------------------------------------------------------------------------
Mithrilhall2000> --------
Mithrilhall2000> 
Mithrilhall2000> Apache-AdvancedExtranetServer/1.3.22 Server at Mithrilhall.LinuxServer
Mithrilhall2000> Port 80
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> This is the error I got in the error log:
Mithrilhall2000> 
Mithrilhall2000> [Mon Apr  1 23:39:40 2002] [error] (2)No such file or directory: exec 
of
Mithrilhall2000> /var/www/cgi-bin/x.cgi failed
Mithrilhall2000> [Mon Apr  1 23:39:40 2002] [error] [client 192.168.1.1] Premature end 
of
Mithrilhall2000> script headers: /var/www/cgi-bin/x.cgi
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> -----Original Message-----
Mithrilhall2000> From: [EMAIL PROTECTED]
Mithrilhall2000> [mailto:[EMAIL PROTECTED]] On Behalf Of Gerald Waugh
Mithrilhall2000> Sent: March 31, 2002 4:54 AM
Mithrilhall2000> To: [EMAIL PROTECTED]
Mithrilhall2000> Subject: Re: [newbie] CGI/Perl question
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> On Sunday 31 March 2002 02:02 am, Mithrilhall2000 wrote:
Mithrilhall2000> > Here ya go:
Mithrilhall2000> >
Mithrilhall2000> > [eric@Mithrilhall cgi-bin]$ ls -lh
Mithrilhall2000> > total 52k
Mithrilhall2000> > -rwxr-xr-x    1 root     root          359 Mar 28 13:12 hello.cgi*
Mithrilhall2000> > -rwxr-xr-x    1 root     root          359 Mar 28 13:13 hello.pl*
Mithrilhall2000> > -rw-r--r--    1 apache   apache        268 Oct 17 15:09 printenv
Mithrilhall2000> > -rwxr--r--    1 root     root          788 Mar 28 22:16 script.cgi*
Mithrilhall2000> > -rw-r--r--    1 apache   apache        757 Oct 17 15:09 test-cgi
Mithrilhall2000> > -rwxr-xr-x    1 root     root          216 Mar 28 14:34 test.cgi*
Mithrilhall2000> > -rwxr-xr-x    1 eric     eric          20k Mar 27 23:48 wwwboard.pl*
Mithrilhall2000> > -rwxr-xr-x    1 root     root           92 Mar 29 00:19 x.cgi*
Mithrilhall2000> > [eric@Mithrilhall cgi-bin]$
Mithrilhall2000> >
Mithrilhall2000> 
Mithrilhall2000> looks like +x is turned on.
Mithrilhall2000> You have to watch ownership to get the cgi
Mithrilhall2000> Also what does /var/log/httpd/error_log  read, after you run the 
script.
Mithrilhall2000> Make sure that #!/usr/bin/perl Is the very first line in the script
Mithrilhall2000> (must be at the top of the page) The '*' in this line must be the very
Mithrilhall2000> first character in the file
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> -- 
Mithrilhall2000> Gerald Waugh : Registered Linux user # 255245
Mithrilhall2000> http://www.frontstreetnetworks.com
Mithrilhall2000> New Haven, CT, United States of America
Mithrilhall2000> 7:10am up 9 days, 15:35, 2 users, load average: 1.05, 1.02, 1.07
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> _________________________________________________________
Mithrilhall2000> Do You Yahoo!?
Mithrilhall2000> Get your free @yahoo.com address at http://mail.yahoo.com
Mithrilhall2000> 
Mithrilhall2000> 
Mithrilhall2000> 


-- 
�����������������������������������������������������������������������
David L. Steiner   Registered Linux User   #262493
Mandrake  8.2      Enlightenment  0.16.5   Sylpheed  0.7.4claws
Email: [EMAIL PROTECTED]   Homepage: www.davidlsteiner.com
�����������������������������������������������������������������������






Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to