WebHostGear.com - the hosting resource for professionalshosting tutorials 
hosting howto webhost guide server managementMarch 14, 2010
server management, apache tutorials, hosting tutorials, cpanel, server security
Home / Hosting Tutorials / mod_perl Install Guide

mod_perl Install Guide



Printer Friendly Printer Friendly Send to a friend Send to a friend
By : ramprage Rating : Average Rating : 7.33 From 9 Voter(s)

How-To Install Mod_perl

Perl/CGI is a very powerful programming language but when used for web applications it can really tax your server’s resources, specifically the CPU.  With CGIProxy, a web based anonymizer similar to Proxify.com; I had noticed my server’s load (A 3.4ghz Pentium 4 with HT and 2GB of RAM) consistently hitting 40 during peak hours.

Fortunately this particular script was designed to work with mod_perl.  Mod_perl is an apache module that loads a separate perl interpreter inside apache at the minute cost of memory and with a drastic reduction of CPU usage.

After configuring mod_perl with apache for this particular script, the server load at peak hovers is healthy at 2, even with twice the visitors!

Configuring mod_perl to work with apache was difficult for me at first, so hopefully this article assist anyone interested in putting this wonderful module to use.  This tutorial is geared for a cPanel server running Apache 1.x and mod_perl 1.x however the httpd.conf instructions should work with any Apache 1.x server with mod_perl installed.

Ensure you are logged in as root in shell and follow these steps:



Article provided by WebHostGear.com

Compile mod_perl with apache in cPanel:
1. type: /scripts/easyapache
2. check for “Perl Module” and make sure it’s enabled
3. Save and Exit

To verify that Apache was configured with mod_perl type:
            /usr/local/apache/bin/httpd –l
It should list: mod_perl.c

Now that Apache has mod_perl loaded as a module, we’ll need to edit our httpd.conf (Apache Config. File) but first it’s a good idea to make a back up:
1. Go into the Apache conf directory: cd /usr/local/apache/conf/
2. Backup: cp httpd.conf httpd.conf.bak
3. Edit: pico httpd.conf

Go to where it your modules are being loaded, it should be under the “Dynamic Shared Object (DSO) Support” section.  Add the following line under the last loaded module:
AddModule mod_perl.c

Now we’ll need to the following information to make any CGI script inside the cgi-bin to be processed with mod_perl & apache instead of Perl.

PerlModule Apache::Registry
<Location /cgi-bin>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
PerlSendHeader Off
allow from all
</Location>

The above lines were added inside the VirtualHost entry of my ProxyMy.com account.

Go ahead and save the file, exit, and restart Apache.

To verify that the changes check your running processed by typing in the command: top cd1

If the CGI script is still running from Perl then the process command will begin with something similar to: /usr/local/bin/perl.  However if you see a copy of Apache loading when the CGI process is executed (/usr/local/apache/bin/httpd –DSSL) then congrats, you’ve configured mod_perl successfully!

About the Author:
Chad Bean is the co-founder of ProxyMy.com

 

New! - Need server help? Hire an Expert

Get professional help with your configuration, script installation or server issue.
Learn how we can help you with any server problem and make your server run like new. Professional staff will contact you, after submitting a quote request, by phone or email.

Rate this Article :

1

2

3

4

5

6

7

8

9

10
Poor Excellent

Related Articles


� Mask Your Web Server for Enhanced Security
� How to install mod_security for Apache
� mod_auth_mysql Apache with cPanel
� Install Mod_Gzip with Apache
� Limit IP downloads in Apache – Save Bandwidth


Discuss this article with others in our new hosting forums

Comments / Feedback

John
Nice article and helpfull information for webmasters. Thanks

 Add Comment
Name
Email
Image Code
Refresh Image

Comments / Feedback



Our site offers free hosting tutorials, cpanel tutorial, web hosting news, shell commands, running a web hosting business, dedicated guides, linux tutorial, apache install, home web server, web server guide, ssh commands, dedicated servers, DNS nameservers, chkrootkit, apf firewall, exim configuration, server compromised, cron backup solution, ftp backup script

Server Tutorials


WebHostGear Reviewed by Ping Zine - Click here

Links:
Lunarpages Coupon