mod-perl and fast-cgi installation

Dec 5, 11:46 PM

i wanted to post what i went thru to get both fastCGI and mod_perl working.

being seriously ‘technically challenged’, it took me quite a bit longer than it will take most normal people.

according to this chart:
http://dmst.aueb.gr/dds/pubs/conf/20…throughput.gif
http://dmst.aueb.gr/dds/pubs/conf/20…l/dyncont.html

it appears that fastCGI is better, but i have no opinion (yet)

below are the steps i went thru to get both working. good luck!

===== f a s t C G I ==========================

  1. http://www.fastcgi.com/devkit/doc/fa…de/ch3perl.htm

#this little program worked out of the box, once i installed fastCGI on the westhost Site Applications manager

#! /usr/bin/perl

use FCGI; # Imports the library; required line

  1. Initialization code

$cnt = 0;

  1. Response loop

while (FCGI::accept >= 0) {
print “Content-type: text/html\r\n\r\n”;
print “\nFastCGI Demo Page (perl)\n\n”;
print “

FastCGI Demo Page (perl)

\n”;
print “This is coming from a FastCGI server.\n
\n”;
print “Running on $ENV{SERVER_NAME} to $ENV{REMOTE_HOST}\n
\n”;
$cnt++;
print “This is connection number $cnt\n”;
}

====== m o d p e r l ==========================
http://www.perl.com/pub/a/2002/03/22…rl.html?page=2

  1. 1) go to your home directory
    cd ~ ;

  1. 2) create a testModPerlDirectory
    mkdir testModPerlDirectory;

  1. 3) set the testModPerlDirectory to world read/execute
    chmod 755 testModPerlDirectory;

  1. 4) go into that directory
    cd testModPerlDirectory;

  1. 5) create the myTestProgram.pl program
    cat > myTestProgram.pl;
#!/usr/bin/perl
print “Content-type: text/plain\n\n”;
print “mod_perl rules!\n”;

perl -c myTestProgram.pl; ## 06) make sure the program works!

  1. 07) add the following lines to the bottom of your mod-perl.conf file:
    cat >> /etc/httpd/conf.d/mod_perl.conf;
    Alias /perl/ /home/yourHomeDirectoryName/testModPerlDirectory/
    PerlModule ModPerl::Registry

    SetHandler perl-script
    PerlHandler ModPerl::Registry
    Options +ExecCGI
    PerlSendHeader On
    allow from all

  1. 08) stop the apache server
    apachectl stop ;

  1. 09) (re)start the apache server
    apachectl start ;

  1. 10) make sure your apache restarted!
    ps -ef | grep httpd ;

  1. look for /usr/sbin/httpd -k start a couple times

now, in your favorite browser: http://yourHostName/perl/myTestProgram.pl

Mark Edwards

,

---

Commenting is closed for this article.

---