J.7. Part III - Installing PHP5

We are now ready for the last step which means compiling PHP5 as a CGI module for Apache. This follows the same principle as the compilation for PHP4 as described above. Again, we use a small configuration script "mkphp5-cgi" which is shown below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/sh
./configure --prefix=/usr/share \
--datadir=/usr/share/php \
--libdir=/usr/share --includedir=/usr/include \
--enable-force-cgi-redirect \
--bindir=/usr/bin \
--with-config-file-path=/etc/php5/apache2 \
--enable-mbstring --enable-mbregex \
--with-mysql  \
--with-gd --enable-gd-imgstrttf --enable-gd-native-ttf \
--with-zlib-dir=/usr/lib \
--with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib \
--with-xpm-dir=/usr/X11R6 \
--with-tiff-dir=/usr/lib --with-ttf-dir=/usr/lib \
--with-freetype-dir=/usr/lib \
--enable-ftp \
--enable-memory-limit --enable-safe-mode \
--bindir=/usr/bin \
--enable-bcmath -enable-calendar \
--enable-ctype --with-ftp \
--enable-magic-quotes \
--enable-inline-optimization \
--with-bz2 \
--with-iconv

Notice that as we said before we have a different configuration path for PHP5 compared with PHP4 as shown above. Also note that in order to build the CGI module we do not configure the "apxs2" option. After successful configuration type "make" but do not type "make install" in order to compile PHP5.

After the compilation have finished copy "sapi/cgi/php" to "/srv/www/gamma2-cgi-bin/php" since this is the place where our virtual host expects to find the PHP5 CGI module.