Published on (
 See this if you're having trouble printing code examples

HTTP Wrangler

LAMP Lighter: The Apache Toolbox

by Rael Dornfest

The Apache Toolbox exemplifies the growing concept of LAMP: Linux, Apache, MySQL, and {Perl,Python,PHP}.

Also this week:

Achieving Low-Latency Response Times Under Linux

Basic Installation of PHP on a Unix System

Exploring the /proc/net/ Directory

BSD Tricks: Linux Compatibility, the Hard Way

If you're involved in any sort of web development, while the acronym LAMP might not be familiar to you, the popular combo of the Linux operating system, Apache Web Server, MySQL database, and PHPherlthon (that's PHP, Perl, and/or Python) scripting languages should definitely ring a bell or three. This dynamic quadro powers an amazing number of your favourite web sites and you're almost sure to have at least three in your current open source development arsenal.

While Linux is the predominant operating system, one should not dismiss *BSD as a powerful player in this field. And while PHP is the scripting cornerstone of LAMP, Perl and Python are the rather obvious swap-ins.

Apache Toolbox

While the LAMP concept is (to quote a friend) "all the rage in Europe" and well understood, it's sometimes difficult for beginners (and, yes, sometime experts) to compile, install, and configure. Bryan Andrew's Apache Toolbox is a Swiss army knife of a script, providing a customisable, menu-driven interface to downloading and compiling a LAMP installation (minus the Linux bit, mind you)--and more! The Apache Toolbox has out of the box support for:

Apache Toolbox comes in two different flavours: a) just the script, which will download the various component sources as needed, or b) the full package, including the script and all required sources. The toolbox even catches RPM conflicts should they arise.

The Apache Toolbox itself is simply a shell script that runs from the command-line. It must be run as root (as it'll remind you) to install all the various bits into their appropriate locations. The first step is a menu-driven GUIsh interface to selecting the various packages you wish to install:

                    Apache Toolbox 1.4.7
        [+] 1)  GD 1.8.3
        [-] 2)  MySQL 3.22.32
        [+] 3)  PHP 4.0.3pl1
        [-] a)     IMAP  functions in PHP
        [-] b)     FTP   functions in PHP
        [-] c)     MySQL already installed on this system
        [-] d)     Postgres already installed on this system
        [-] e)     mcrypt support
        [-] f)     mhash support
        [-] 4)     Zend Optimizer (php4 20%-100% faster!)
        [-] 5)  SSL
[-] 6) -Mod Throttle 211    [-] 7) -WebDAV 1.0.2-1.3.6
[-] 8) FastCGI              [-] 9) -Mod AuthNDS 0.5
[-] 10) -Mod Layout         [-] 11) -Mod GZIP
[-] 12) -Mod DynaVHost      [-] 13) -Mod Ro AuthSYS
[-] 16) -Mod Bandwidth      [-] 17) -Mod Perl 1.24_01
[-] 18) -Mod Auth LDAP      [-] X) OpenLDAP Required (auth_ldap)
[-] 19) -Mod Auth Radius    [-] 20) -Mod Auth POP3
                   go)  -=CONTINUE=-
                   q)     -=EXIT=-
                   99)   Descriptions

Not sure what all these goodies are? Type 99<enter> for complete descriptions. After putting together your grocery list of preferred features, type go<enter> and the toolbox springs into action. First stop... RPM conflict checks:

-------------- Scanning for RPM's ---------------------
Testing for PHP RPM... not found.
Testing for PHP IMAP RPM... not found.
Testing for GD RPM... not found.
Testing for GD Devel RPM... not found.
Testing for Apache RPM... not found.
Testing for OpenLDAP RPM... not found.
Testing for OpenLDAP Devel RPM... not found.
[+] Wget found!

The toolbox confirms Apache install path (/usr/local/apache), allowing you to change the final destination per your preference, then continues on its way.

Any time a source (tar.gz archive) isn't found, the toolbox script prompts you for permission to download it:

[+] Setting up Apache source...
[-] apache_1.3.14.tar.gz detection failed
Do you wish to download it now? [y/n] y

  apache_1.3.14.tar.gz => `apache_1.3.14.tar.gz'
Connecting to connected!
Logging in as anonymous ... Logged in!
==> TYPE I ... done.  ==> CWD pub/apache/dist ... done.
==> PORT ... done.    ==> RETR apache_1.3.14.tar.gz ... done.
Length: 1,813,581 (unauthoritative)

 0K -> .......... .......... .......... .......... [  2%]
50K -> .......... .......... .......... .......... [  5%]

The toolbox then silently hums away configuring, integrating, pre-heating, and so on...

[+]  Uncompressed Apache source...
[+]  Getting apache pre-configured
[+]  Apache pre-configured
[+]  Apache httpd.conf-dist updated for SSI support
[+] Getting GD lib's with PNG and zlib support ready...

After a short while, the toolbox gives you the chance to edit the Apache configuration script, if you're just that bold. If all's well you should end up with a rather familiar site if you've ever configured Apache before:

Configuring for Apache, Version 1.3.14
 + using installation path layout: Apache (config.layout)
 + activated php4 module (modules/php4/libphp4.a)
 + Warning: You have enabled the suEXEC feature. Be aware 
 + that you need root privileges to complete the final 
 + installation step.
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
 + configured for Linux platform
Creating Makefile in src/modules/standard
Creating Makefile in src/modules/php4
[+] Done Configuring Apache source

If there where _no_ errors run "cd apache_1.3.14;make" now.
Start debugging and have a blast...
Run "make install" in the apache source
directory to install apache 1.3.14  

Mosey on over to the apache directory, as specified, make, make test, and make install! For further information on building Apache, visit one of the previous HTTP Wrangler columns.


The following is a list of starting points from which to explore further some of the topics covered (or not) in this article.

Rael Dornfest is Founder and CEO of Portland, Oregon-based Values of n. Rael leads the Values of n charge with passion, unearthly creativity, and a repertoire of puns and jokes — some of which are actually good. Prior to founding Values of n, he was O'Reilly's Chief Technical Officer, program chair for the O'Reilly Emerging Technology Conference (which he continues to chair), series editor of the bestselling Hacks book series, and instigator of O'Reilly's Rough Cuts early access program. He built Meerkat, the first web-based feed aggregator, was champion and co-author of the RSS 1.0 specification, and has written and contributed to six O'Reilly books. Rael's programmatic pride and joy is the nimble, open source blogging application Blosxom, the principles of which you'll find in the Values of n philosophy and embodied in Stikkit: Little yellow notes that think.

Read more HTTP Wrangler columns.

Also this week:

Achieving Low-Latency Response Times Under Linux

Basic Installation of PHP on a Unix System

Exploring the /proc/net/ Directory

BSD Tricks: Linux Compatibility, the Hard Way

Discuss this article in the O'Reilly Network Apache Forum.

Return to the Apache DevCenter.


Copyright © 2009 O'Reilly Media, Inc.