6.4. Installing Midgard as static modules in Apache

Some may want to include Midgard as static modules, for example in case the DSO fails. I've seen this problem with Solaris specifically.

I will installin
Midgard-lib/usr/local/midgard
Apache/usr/local/apache
MySQL/usr/local/mysql

Table 6-1. Installation paths

I have installed both the mysql and the midgard libraries in non-standard (as far as the compiler is concerned) locations for illustration purposes.

Unpack the following archives in /usr/local/src:

set the following environment variables:

# export LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql:/usr/local/midgard/lib:$LD_LIBRARY_PATH
# export PATH=/usr/local/bin:/usr/ccs/bin:/usr/ucb:/usr/sbin:/usr/bin:$PATH
# export CC=gcc
# export LDFLAGS="-L/usr/local/mysql/lib/mysql -L/usr/local/midgard/lib -lmidgard -lmysqlclient -lgcc"
# export CFLAGS=-I/usr/local/midgard/include

The order in PATH is relevant, BTW.

Here we go. We start with MySQL:

# cd/usr/local/src/mysql-3.22.27
# ./configure --prefix=/usr/local/mysql
# make
# make install

then midgard-lib

# cd ../midgard-lib-1.2.3
# ./configure --with-mysql=/usr/local/mysql/ --prefix=/usr/local/midgard
# make
# make install

now preconfigure Apache

# cd ../apache_1.3.9
# ./configure --prefix=/usr/local/apache --enable-module=so
# make
# make install

and mod_midgard

# cd ../mod_midgard-1.2.3
# ./configure --with-midgard=/usr/local/midgard --with-apache=/usr/local/apache

install midgard-php in the apache source tree

# cd ../midgard-lib-1.2.3
# ./configure --with-midgard=/usr/local/midgard --with-apache=../apache_1.3.9 --with-mysql=/usr/local/mysql --enable-track-vars
# make
# make install

now build and install apache

# cd ../apache_1.3.9
# ./configure --prefix=/usr/local/apache --enable-module=so --activate-module=src/modules/php3/libphp3.a --add-module=../mod_midgard-1.2.3/mod_midgard.c
$ make
# make install

That should be it. Most of the "set these variables" section can be omitted if you install stuff in places where the compiler and the shell will look by default.