CompilingApache
Introduction
These days people usually don't compile apache, so below are historical notes.
Compiling Apache 1.x with mod_perl
The mod_perl1 guide can be found at: http://perl.apache.org/docs/1.0/guide/
The following is an excerpt, which should work for most people. Download the source tarballs for apache and for mod_perl, and then:
% tar xzvf apache_x.x.x.tar.gz % tar xzvf mod_perl-x.xx.tar.gz % cd mod_perl-x.xx % perl Makefile.PL \ % APACHE_SRC=../apache_x.x.x/src \ % USE_APACI=1 \ % DO_HTTPD=1 \ % EVERYTHING=1 % make && make test && make install % cd ../apache_x.x.x % make install
This builds Apache statically with mod_perl, installs Apache under the default /usr/local/apache tree and mod_perl into the site_perl hierarchy of your existing Perl installation.
Do not omit the EVERYTHING=1 parameter.
Another variant from RuslanZakirov
I use this variant for ages and I don't have any problems, like seg faults or mod_perl1/mod_php/mod_ssl/libexpat compatibilities. This method allow compile other third party modules that support APACI (mod_php for example, but you shouldn't compile mod_php as DSO if mod_perl is not a DSO module).
This variant as well allows you to execute apache's ./configure
script and change default properties.
- Get sources
% tar -xzvf apache_1.3.xx.tar.gz % tar -xzvf mod_perl-1.xx.tar.gz % cd mod_perl-1.xx
- Configure mod_perl and say it use APACI and don't build httpd
% perl Makefile.PL \ % APACHE_SRC=../apache_1.3.xx/src \ % USE_APACI=1 \ % NO_HTTPD=1 \ % PREP_HTTPD=1 \ % EVERYTHING=1
- this would move source to
apache_1.3.xx/src
and prepare it for apache compile process
% make
- here you can prepare other third party modules, but be aware some modules require
make install
too, because they don't move required files intoapache_1.3.xx/src
dir when you runmake
. Such crappy module is mod_php :)
% cd other modules dir and prepare it % ...
- when you prepared all required modules, go to apache source dir
% cd ../apache_x.x.x
- now you should configure apache and activate modules.
% ./configure \
- I use default apache prefix (apache layout) because I don't want to mix it with distro's server, but you can change it
% --prefix=/usr/local/apache \
- you should activate mod_perl and other mods
% --activate-module=src/modules/perl/libperl.a \
- now small trick for those who has libexpat in system and wish to use any perl XML module which depends on libxml. In most cases people have libexpat.
% --disable-rule=EXPAT \
- now all other configure options if you wish
% ...
- compile apache
% make
- return back to mod_perl, because you wish to run tests against this new build. you should do it before you'll install apache or mod_perl and overwrite your current well-running server with new, but broken(may be)
% cd ../mod_perl-1.xx % make test
- now you can install it if all tests are ok
% make install % cd ../apache_1.3.xx % make install
Edit default httpd.conf and enjoy your new Apache+mod_perl+what_ever_you_want build.
Compiling Apache with Mod Perl statically, but allow other modules as DSO
If you wish to compile mod_perl with apache statically, but want to have apache open to use dynamic modules later, then add --enable-module=so
option when run configure script of apache:
% ./configure \ % --prefix=/usr/local/apache \ % --activate-module=src/modules/perl/libperl.a \ % --disable-rule=EXPAT \ % --enable-module=so \ % ...
See also
See also: notes about mod_perl in CompilingPerl and in ManualRequirements