"Amigos y nadie más. El resto, la selva"
-- Jorge Guillén

Compiling: Apache & mod_ssl & OpenSSL & PHP4 & MySQL & IMAP & mod_perl

From the development-ummmmm-compiling-is-sweet dept. (6289) (0) by Luis

Tired of looking for ways to compile the latest binary of Apache? Want to get some extra nifty functionality in your webpage? All this can be done with Linux, but how to get to it... Read this article if you are one of us who are always looking for ways to enhance your servers.

Apache + mod_ssl/OpenSSL + PHP4/MySQL + IMAP + mod_perl

by Luis M Aug 31, 2001

Decide where to install:


is usually /etc/httpd


  1. Create symlinks to folders to make your life easier e.g.

    ln -s apache_1.3.xx apache
    ln -s mod_ssl-version mod_ssl

...and so on...

  1. Create scripts with the commands you use to configure the binaries. e.g.

    $ cd apache
    $ vi mycommand

    type everything you need then make your script executable

    $ chmod 0755 mycommand
    $ ./mycommand

  2. Get Source:

    extract the packages

    i like using tar -xzvf instead

    $ cd /usr/src
    $ tar xzvf apache_1.3.x.tar.gz
    $ tar xzvf mod_ssl-2.8.x-1.3.x.tar.gz
    $ tar xzvf php-4.0.x.tar.gz
    $ tar xzvf openssl_source.tar.gz
    $ tar xzvf imap_source.tar.gz

NOTE: create symlinks to folders to make your life easier e.g.

ln -s apache_1.3.xx apache
ln -s mod_ssl-version mod_ssl
#...and so on...
  1. Compilation:


cd openssl
make test
make install


cd ../imap
make slx

Apply mod_ssl to Apache source tree:

$ cd ../mod_ssl-2.8.x-1.3.x
$ ./configure --with-apache=../apache_1.3.x
$ cd ..

Pre-configure Apache for PHP4's configure step:

$ cd ../apache_1.3.x
$ ./configure --prefix=/path/to/apache
$ cd ..

Configure PHP4 and apply it to the Apache source tree:

$ cd ../php-4.0.x
$ CFLAGS='-O2 -I/path/to/openssl/include' 
$ ./configure --with-apache=../apache_1.3.x \
--with-mysql=/path/to/mysql --enable-memory-limit=yes \

NOTE: with php4.0.6 i used the following options.
Note the use of symlinks to the original folders. Type ./configure --help
if you want/need more options:

CFLAGS='-I/usr/src/openssl-0.9.6' ./configure --with-mysql --with-imap=/usr/src/imap 
--target=i386-redhat-linux --enable-track-vars --enable-magic-quotes --disable-debug 
--enable-debugger --enable-inline-optimization --with-exec-dir=/usr/bin --with-png 
--with-jpeg-dir=/usr --enable-ftp --enable-sysvsem --enable-memory-limit=yes 
--enable-sysvshm --with-config-file-path=/etc --enable-pic --with-exec-dir=/usr/bin
--enable-force-cgi-redirect --with-apache=../apache
$ make
$ make install

Build/install mod_perl. You can do this in two different ways:

1) From the command shell type:

$ perl -MCPAN -e shell 

Then type:

cpan> i /mod_perl/

When you find it type:

cpan> install mod_perl

Then follow the instructions.

2) This is a better method. Get the source code for mod_perl
and put it in /usr/src/mod_perl and then type this:

$ cd /usr/src/mod_perl
$ perl Makefile.PL APACHE_SRC=/usr/src/apache/src/ DO_HTTPD=1 USE_APACI=1 EVERYTHING=1
$ make && make test && make install

Build/install Apache with mod_ssl and PHP4:

$ cd /usr/src/apache_1.3.x
$ SSL_BASE=/usr/src/openssl ./configure  --prefix=/etc/httpd --enable-module=so --enable-module=mime_magic --enable-module=ssl --activate-module=src/modules/perl/libperl.a --activate-module=src/modules/php4/libphp4.a --enable-module=php4

Command I used:

CFLAGS=" -fno-strict-aliasing" 
SSL_BASE=/usr/src/openssl ./configure --prefix=/etc/httpd --enable-module=so --enable-module=mime_magic --enable-module=ssl --enable-module=headers --enable-module=cern_meta --enable-module=log_agent --enable-module=log_referer --enable-module=usertrack --enable-module=info --enable-module=rewrite --activate-module=src/modules/perl/libperl.a --activate-module=src/modules/php4/libphp4.a --enable-module=php4 --disable-rule=EXPAT 
$ make
$ make certificate
$ make install
$ cd ..


You should see a dialog like this:

| You now have successfully built and installed the|
| Apache 1.3 HTTP server. To verify that Apache actually|
| works correctly you now should first check the|
| (initially created or preserved) configuration files|
| |
| /etc/httpd/conf/httpd.conf|
| |
| and then you should be able to immediately fire up |
| Apache the first time by running: |
| |
| /etc/httpd/bin/apachectl start|
| |
| Or when you want to run it with SSL enabled use: |
| |
| /etc/httpd/bin/apachectl startssl|
| |
| Thanks for using Apache. The Apache Group |
| http://www.apache.org/ |


New Comment

* optional