Fedora Core 2 Apache CGI

Simon Andrews simon.andrews at bbsrc.ac.uk
Tue Nov 9 09:58:00 UTC 2004


Brian McDonald wrote:
> I am trying to get Perl cgi running on my FC2 Apache.

>  From my error_log
> [Sun Nov 07 15:43:00 2004] [error] [client 192.168.1.101] (2)No such 
> file or directory: exec of '/var/www/cgi-bin/test.cgi' failed

I'm guessing that the first line of your script is actually blank and 
that the #! line is line 2?  This line needs to be the very first line 
in your script.

You should also verify that perl is installed in /usr/bin, and that 
there aren't any funny non-printing characters at the end of your first 
line (it's always safest to use:

#!/usr/bin/perl --

as the first line).


> [Sun Nov 07 15:43:00 2004] [error] [client 192.168.1.101] Premature end 
> of script headers: test.cgi

> this is the test.cgi script
> #!/usr/bin/perl
> use strict;    
> use warnings;   
> print "What is your username? ";  
> my $username;    
> $username = <STDIN>;   
> chomp($username);   
> print "Hello, $username.\n";   

This isn't a CGI script.  You can't just take a command line script and 
put it onto a webserver.  You need to do some reading about how CGI 
works.  You should also have a look at the CGI module for Perl which 
will make your life a lot easier.

http://hoohoo.ncsa.uiuc.edu/cgi/overview.html

http://search.cpan.org/~lds/CGI.pm-3.05/CGI.pm

HTH

Simon.




More information about the fedora-list mailing list