Getting Started with mod_perl in 30 Minutes Page 3

This command prepares mod_perl extension files, installs them in the Apache source tree and builds the httpd executable (the web server itself) by compiling all the required files. Upon completion of the make process you get returned to the mod_perl source distribution directory.

make test executes various mod_perl tests on the freshly built httpd executable.

  % make test

This command starts the server on a non-standard port (8529) and tests whether all parts of the built server function correctly. If something goes wrong, the process will report it to you.

make install completes the installation process of mod_perl by installing all the Perl files required for mod_perl to run and of course the server documentation (man pages):

  % make install

You can use the following commands concatenation style:

  % make && make test && make install

It simplifies the installation, since you don't have to wait for each command to complete before starting the next one. When installing mod_perl for the first time, it's better to do it step by step.

If you choose the all-in-one approach, you should know that if make fails, neither make test nor make install will be executed. If make test fails, make install will be not executed.

Finally, change to the Apache source distribution directory and run make install to create the Apache directory tree and install Apache header files (*.h), default configuration files (*.conf), the httpd executable, and a few other programs:

  % cd ../apache_1.3.12
  % make install

Note that, as with a plain Apache installation, any configuration files left from a previous installation won't be overwritten by this process. You don't need to backup your previously working configuration files before the installation.

When the make install process completes, it will tell you how to start a freshly built web server (the path to the apachectl utility that is being used to control the server) and where the installed configuration files are. Remember or even better write down both of them, since you will need this information very soon. On my machine the two important paths are:


So far we have completed the building and installation of the mod_perl enabled Apache. The next steps are to configure httpd.conf, write a little test script, start the server and check that the test script is working.

Configuring and Starting mod_perl Server

First thing first: we want to make sure our Apache was built correctly and that we can serve plain HTML files with it. Why do that? To minimize the number of possible trouble makers, if we find out that mod_perl doesn't work. After you know that Apache can serve HTML files, you don't have to worry about it anymore. And if something goes wrong with mod_perl, you have eliminated the possibility that the httpd binary or basic configurations are broken, you know you are allowed to bind to the port you have configured your server to listen to, and that the browser you're testing with is just fine. Again, you should follow these guidelines when installing mod_perl for the first time.

This article was originally published on Jun 23, 2000

Thanks for your registration, follow us on our social networks to keep up-to-date