Changing Your Sites MX Record Published: Oct 12, 2005
  • Rating


mod_perl Install Guide with step by step instructions making Perl run faster and better with Apache.

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; 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:

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

The above lines were added inside the VirtualHost entry of my 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


  • Rating


Related Articles

Comments (8)

  • Gravatar - abubin
    abubin 06:36, October 26, 2005
    Do I need to be running own DNS server for this to work?<br />
    <br />
    What if I am using DNS server from my webhost?
  • Gravatar - joel
    joel 06:14, February 6, 2006
    what daemon will handle the mail if not exim? I still want to see the message queue in WHM
  • Gravatar - joel
    joel 07:06, February 6, 2006
    Will this not work if exim is allowed to continue to handle email? Steps 8 and 9 are too risky for me - and step 10 is already correct. Help?
  • Gravatar - JC John SESE Cuneta
    JC John SESE Cuneta 09:25, August 11, 2006
    @joel, I'm not an expert in this, but as far as I'm concerned, my server setting is working properly without doing Steps #8 and 9.<br />
    <br />
    If I understood it correctly, doing those two steps will keep your server from reprocessing your old local mail.yourdomain.tld setup. So next time for example, EXIM rechecks itself, it won't run again for the domain mail you changed.<br />
    <br />
    ^^<br />
    <br />
  • Gravatar - Alex
    Alex 08:24, May 2, 2007
    I changed MX record to now when sending test email it bounces back? Technical details of permanent failure: 553 sorry, mailbox unavailable (#4.7.1) ** Please confirm if this is normal?
  • Gravatar - pritpal singh
    pritpal singh 11:32, March 13, 2009
    sir,<br />
    Very much thanks.... for your help to me in changing mx record properly..... thanks for your service to the community...<br />
    you done a great job<br />
  • Gravatar - RealGroup
    RealGroup 14:46, March 21, 2009
    Good, Really good information. The screen shots takes to the perfect steps. <br />
    Thank You Very Much.<br />
  • Gravatar - theh1982
    theh1982 11:23, August 6, 2009
    This video tutorial helped me a lot <br /><br />
    <br />
    <br />

Add Your Thoughts is a hosting directory, not a web host.

Copyright © 1998-2020