kathys39 has asked for the wisdom of the Perl Monks concerning the following question:

I have Fedora Core 2, with apache 2.0.48 and am trying to run some very basic perl scripts from within cgi-bin. Instead of perl output (i.e., instead of seeing "hello world", I see the perl code itself. What do I have setup wrong? I have mod_perl enabled and running; am getting NO errors in httpd logs. I have the following added to my httpd.conf: AddHandler cgi-script .cgi .pl LoadModule perl_module modules/mod_perl.so Thanks.

Replies are listed 'Best First'.
Re: running perl script in apache
by Joost (Canon) on Oct 15, 2004 at 11:58 UTC
      Yep, I've already got that line in httpd.conf. All scripts are owned by apache, executable by everyone... I'm pretty sure it's a setup problem because I can't even get the stupid Hello World to print out, but I've not done perl thru cgi/apache before.
Re: running perl script in apache
by zentara (Cardinal) on Oct 15, 2004 at 13:27 UTC
    I have the following added to my httpd.conf:

    AddHandler cgi-script .cgi .pl LoadModule perl_module modules/mod_perl.so

    You probably need more than that simple line in your httpd.conf. For example, here are some entries for mod_perl in my old httpd.conf from a default slackware system. This isn't an answer to your specific problem, but I'm showing it so you can see all the other conf entries which you may need.

    There are some more mod_perl tips at Can't figure with mod_perl

    #<Directory /home/*/public_html/mod_perl> #AllowOverride FileInfo AuthConfig Limit # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec #Options MultiViews Indexes SymLinksIfOwnerMatch #SetHandler perl-script #PerlHandler Apache::Registry #PerlSendHeader On #Options +ExecCGI # <Limit GET POST OPTIONS PROPFIND> # Order allow,deny # Allow from all # </Limit> # <LimitExcept GET POST OPTIONS PROPFIND> # Order deny,allow # Deny from all # </LimitExcept> #</Directory> <IfModule mod_perl.c> # Provide two aliases to the same cgi-bin directory, # to see the effects of the 2 different mod_perl modes. # for Apache::Registry Mode ScriptAlias /perl/ "/srv/www/cgi-bin/" # for Apache::Perlrun Mode ScriptAlias /cgi-perl/ "/srv/www/cgi-bin/" </IfModule> # # If mod_perl is activated, load configuration information # <IfModule mod_perl.c> Perlrequire /usr/include/apache/modules/perl/startup.perl PerlModule Apache::Registry # # set Apache::Registry Mode for /perl Alias # #<Location /perl> #SetHandler perl-script #PerlHandler Apache::Registry #Options ExecCGI FollowSymLinks #PerlSendHeader On #</Location> # # set Apache::PerlRun Mode for /cgi-perl Alias # <Location /cgi-perl> SetHandler perl-script PerlHandler Apache::PerlRun Options ExecCGI PerlSendHeader On </Location> </IfModule>

    I'm not really a human, but I play one on earth. flash japh