Compiling PHP5

Client version

#! /bin/sh
# mkphp5-cli
# Build a command line version of PHP5
./configure \
--prefix=/usr/share/php5 \
--datadir=/usr/share/php5 \
--libdir=/usr/share/php5 \
--includedir=/usr/include/php5 \
--enable-force-cgi-redirect \
--bindir=/usr/bin \
--with-config-file-path=/etc/php5/cli \
--with-config-file-scan-dir=/etc/php5/cli \
--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 \
--enable-bcmath -enable-calendar \
--enable-ctype \
--with-ftp \
--enable-magic-quotes \
--enable-inline-optimization \
--enable-tokenizer \
--with-bz2 \
--with-iconv \
--with-pear=/usr/share/php5

Apache module

#! /bin/sh
# mkphp5-sapi
# Build a SAPI (Apache module) version of PHP5
./configure --prefix=/usr/share \
--datadir=/usr/share/php --with-apxs2=/usr/sbin/apxs2 \
--libdir=/usr/share --includedir=/usr/include \
--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

!#

CGI extension

#! /bin/sh
# mkphp5-cgi
# Build a CGI version of PHP5
./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-native-ttf \
--with-zlib-dir=/usr/lib \
--with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-xpm-dir=/usr/X11R6 \
--with-freetype-dir=/usr/lib \
--enable-ftp \
--enable-safe-mode \
--bindir=/usr/bin \
--enable-bcmath -enable-calendar \
--enable-ctype \
--enable-magic-quotes \
--enable-inline-optimization \
--enable-tokenizer \
--with-bz2 \
--with-iconv