Installing Apache, PHP 4 as CGI, PHP 5 as Module, MySql, PostgreSql, OpenSSL, Tomcat, Mod_Python, Mod_Perl, ZLib, LibXml, LibJpg, LibPng, LibFreetype, GD
Posted by elg3ne on 5 May 2008 2:04 pm. Filed under Scipts & Tutorials.
####################################################
##### ZLIB #####
http://www.gzip.org/zlib/
cd zlib-version
./configure --prefix=/usr/local/zlib
make
make install
####################################################
##### LIBXML #####
ftp://xmlsoft.org/
cd libxml-version
./configure --prefix=/usr/local/libxml --with-zlib=/usr/local/zlib
make
make install
####################################################
##### LIBJPG #####
wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.version.tar.gz
cd jpeg-version
./configure --enable-shared
make
make install
make install-lib
ranlib /usr/local/lib/libjpeg.a
####################################################
##### LIBPNG #####
wget http://puzzle.dl.sourceforge.net/sourceforge/libpng/libpng-version.tar.gz
cd libpng-version
cp scripts/makefile.std ./
cp makefile.std Makefile
make
make test
make intall
####################################################
##### LIBFREETYPE #####
http://freetype.sourceforge.net/download.html
cd freetype-version
./configure --prefix=/usr/local/freetype
make
make intall
####################################################
##### GD LIBRARY #####
http://www.boutell.com/gd/
cd gd-version
./configure --prefix=/usr/local/gd-2.0 --with-png=/usr/local/lib --with-jpeg=/usr/local/lib --with-freetype=/usr/local/freetype
make
make intall
####################################################
##### OPENSSL #####
cd openssl-version
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
make
make test
make install
####################################################
##### APACHE #####
http://httpd.apache.org
./configure --prefix=/usr/local/httpd --enable-modules=all --enable-FEATURE --enable-dbd --enable-mime-magic --enable-headers --enable-usertrack --enable-ssl --enable-http --enable-info --enable-cgi --enable-cgid --enable-rewrite --enable-so --enable-force-cgi-redirect --with-ssl=/usr/local
# old configure
./configure --prefix=/usr/local/httpd --enable-modules=all --enable-ssl --enable-so --enable-track-vars --enable-force-cgi-redirect --with-gettext --enable-module=log_referer --enable-module=log_config --enable-module=log_agent --enable-module=mime --enable-shared=info --enable-module=so --enable-shared=ssl --enable-module=ssl --enable-rule=SHARED_CORE
make
make install
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
--- SNIP ---
# chkconfig: 2345 55 25
# description: HTTPD
--- END ---
####################################################
##### CREATE SELF-SIGNED SSL CERTIFICATE #####
mkdir /usr/local/httpd/conf/ssl
cd /usr/local/httpd/conf/ssl
openssl genrsa -des3 -out server.key 1034
openssl req -new -key server.key -out server.csr
cp server.key server.key.orig
openssl rsa -in server.key.orig -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
vi /usr/local/httpd/conf/httpd.conf
--- SNIP ---
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
--- END ---
vi /usr/local/httpd/conf/extra/httpd-ssl.conf
--- SNIP ---
SSLCertificateFile "/usr/local/httpd/conf/ssl/server.crt"
SSLCertificateKeyFile "/usr/local/httpd/conf/ssl/server.key"
--- END ---
####################################################
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
##### TOMCAT #####
http://www.opensourcecommunity.ph/apache/jakarta/
tar -zxf jakarta-tomcat-VERSION
cd jakarta-tomcat-VERSION
./configure
make
make install
##### If TOMCAT is already build #####
tar -zxf jakarta-tomcat-VERSION
mv jakarta-tomcat-VERSION /usr/local/tomcat
####################################################
##### TOMCAT CONNECTOR #####
http://www.opensourcecommunity.ph/apache/jakarta/tomcat-connectors/jk
tar -zxf jakarta-tomcat-connectors-jk-VERSION
cd jakarta-tomcat-connectors-jk-VERSION/jk/native
./buildconf.sh
./configure --with-apxs=/usr/local/httpd/bin/apxs
make
make install
##### edit httpd.conf & put the line: #####
vi /usr/local/httpd/conf/httpd.conf
--- SNIP --
# Tomcat Module
Include /usr/local/httpd/conf/mod_jk.conf
--- END ---
##### create mod_jk.conf & put the line: #####
# Tomcat Module
vi /usr/local/httpd/conf/mod_jk.conf
--- SNIP --
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /usr/local/httpd/conf/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /usr/local/httpd/logs/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /usr/local/httpd/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /examples/* worker1
--- END ---
##### create workers.properties (standard) & put the line: #####
vi /usr/local/httpd/conf/workers.properties
--- SNIP --
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
ps=/
worker.list=ajp12, ajp13
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=ajp12, ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line=start
# IBM JDK1.3
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
--- END ---
####################################################
##### MOD_PYTHON #####
http://www.opensourcecommunity.ph/apache/httpd/modpython/
./configure --with-apxs=/usr/local/httpd/bin/apxs
make
make install
####################################################
##### MOD_PERL #####
http://perl.apache.org/download/index.html
perl Makefile.PL MP_APXS=/usr/local/httpd/bin/apxs
make
make test
make install
##### edit httpd.conf & put the line #####
vi /usr/local/httpd/conf/httpd.conf
--- SNIP ---
# PERL module
LoadModule perl_module modules/mod_perl.so
--- END ---
####################################################
##### INSTALL MYSQL #####
tar -zxf mysql-version.tar.gz
mv mysql-version /usr/local/mysql
adduser mysql -d /usr/local/mysql/data -s /bin/false
chown -R mysql.mysql /usr/local/mysql/data*
####################################################
##### POSTGRESQL #####
http://postgresql.net
cd postgresqlVERSION
./configure --prefix=/usr/local/pgsql --without-readline
make
make install
adduser postgres -d /var/lib/pgsql -s /bin/false
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
####################################################
##### PHP XML RPC EPI #####
http://xmlrpc-epi.sourceforge.net/
tar -zxf xmlrpc-epi-version
cd xmlrpc-epi-version
./configure
make
make install
####################################################
##### LIB EXPAT #####
http://expat.sourceforge.net/
tar -zxf expat-version
cd expat-version
./configure
make
make install
####################################################
ln -s /usr/local/sbin/* /usr/sbin/
ln -s /usr/local/bin/* /usr/bin/
ln -s /usr/local/lib/* /usr/lib/
ln -s /usr/local/libexec/* /usr/libexec/
ln -s /usr/local/libexec/* /usr/bin/
ln -s /usr/local/include/* /usr/include/
####################################################
##### PHP 4 AS CGI #####
http://php.net
##### ORIG #####
####./configure --prefix=/usr/local/php4 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql-dir=/usr/local/mysql --with-pgsql-dir=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php4/cgi --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring
##### FOR CGI REMOVE APXS2 #####
./configure --prefix=/usr/local/php4 --exec-prefix=/usr/local/php4 --with-config-file-path=/usr/local/etc/php4 --with-mysql-dir=/usr/local/mysql --with-pgsql-dir=/usr/local/pgsql --with-pcre-regex=yes --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring --with-xmlrpc=/usr/local --with-openssl=/usr/local --with-openssl-dir=/usr/local
make
make install
mkdir -p /usr/local/etc/php4/
cp php.ini-dist /usr/local/etc/php4/php.ini
##### edit httpd.conf & put the line #####
vi /usr/local/httpd/conf/httpd.conf
--- SNIP ---
# comment php4 module if any
#LoadModule php4_module modules/libphp4.so
# directory index
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm
# PHP 4 as CGI
ScriptAlias /php-cgi/ "/usr/local/httpd/php-cgi/"
Action application/x-httpd-php4 "/php-cgi/php4"
AddHandler application/x-httpd-php4 .php4
<directory>
AllowOverride None
Options None
Order allow,deny
Allow from all
</directory>
--- END ---
mkdir /usr/local/httpd/php-cgi
cp /usr/local/php4/bin/php /usr/local/httpd/php-cgi/php4
chown apache.apache /usr/local/httpd/php-cgi/php4
chmod 755 /usr/local/httpd/php-cgi/php4
vi /usr/local/etc/php4/php.ini
##### edit php 4's php.ini & add this line #####
--- SNIP ---
; PHP4 as CGI
cgi.fix_pathinfo = 1 ; needed for CGI/FastCGI mode
--- END ---
####################################################
##### PHP 5 AS MODULE #####
http://php.net
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php5/ --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring --with-xmlrpc=/usr/local --with-openssl=/usr/local --with-openssl-dir=/usr/local
# Old configure
#./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php5/ --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring
make
make install
mkdir -p /usr/local/etc/php5/
cp php.ini-dist /usr/local/etc/php5/php.ini
vi /usr/local/httpd/conf/httpd.conf
##### edit httpd.conf & put the line: #####
--- SNIP ---
# directory index
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm
# PHP5 as module
AddType application/x-httpd-php .php .php5 .php3 .phtml
AddType application/x-httpd-php-source .phps
--- END ---
ln -s /usr/local/php5/bin/* /usr/bin
ln -s /usr/local/php5/lib/* /usr/lib
ln -s /usr/local/php5/include/* /usr/include
####################################################
##### PHP XML RPC #####
http://phpxmlrpc.sourceforge.net/
cd xmlrpc-version
vi Makefile
--- SNIP ---
PHP=/usr/local/bin/php
PHPINCLUDEDIR=/usr/local/php5/lib
--- END ---
make install
##### ZLIB #####
http://www.gzip.org/zlib/
cd zlib-version
./configure --prefix=/usr/local/zlib
make
make install
####################################################
##### LIBXML #####
ftp://xmlsoft.org/
cd libxml-version
./configure --prefix=/usr/local/libxml --with-zlib=/usr/local/zlib
make
make install
####################################################
##### LIBJPG #####
wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.version.tar.gz
cd jpeg-version
./configure --enable-shared
make
make install
make install-lib
ranlib /usr/local/lib/libjpeg.a
####################################################
##### LIBPNG #####
wget http://puzzle.dl.sourceforge.net/sourceforge/libpng/libpng-version.tar.gz
cd libpng-version
cp scripts/makefile.std ./
cp makefile.std Makefile
make
make test
make intall
####################################################
##### LIBFREETYPE #####
http://freetype.sourceforge.net/download.html
cd freetype-version
./configure --prefix=/usr/local/freetype
make
make intall
####################################################
##### GD LIBRARY #####
http://www.boutell.com/gd/
cd gd-version
./configure --prefix=/usr/local/gd-2.0 --with-png=/usr/local/lib --with-jpeg=/usr/local/lib --with-freetype=/usr/local/freetype
make
make intall
####################################################
##### OPENSSL #####
cd openssl-version
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
make
make test
make install
####################################################
##### APACHE #####
http://httpd.apache.org
./configure --prefix=/usr/local/httpd --enable-modules=all --enable-FEATURE --enable-dbd --enable-mime-magic --enable-headers --enable-usertrack --enable-ssl --enable-http --enable-info --enable-cgi --enable-cgid --enable-rewrite --enable-so --enable-force-cgi-redirect --with-ssl=/usr/local
# old configure
./configure --prefix=/usr/local/httpd --enable-modules=all --enable-ssl --enable-so --enable-track-vars --enable-force-cgi-redirect --with-gettext --enable-module=log_referer --enable-module=log_config --enable-module=log_agent --enable-module=mime --enable-shared=info --enable-module=so --enable-shared=ssl --enable-module=ssl --enable-rule=SHARED_CORE
make
make install
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
--- SNIP ---
# chkconfig: 2345 55 25
# description: HTTPD
--- END ---
####################################################
##### CREATE SELF-SIGNED SSL CERTIFICATE #####
mkdir /usr/local/httpd/conf/ssl
cd /usr/local/httpd/conf/ssl
openssl genrsa -des3 -out server.key 1034
openssl req -new -key server.key -out server.csr
cp server.key server.key.orig
openssl rsa -in server.key.orig -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
vi /usr/local/httpd/conf/httpd.conf
--- SNIP ---
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
--- END ---
vi /usr/local/httpd/conf/extra/httpd-ssl.conf
--- SNIP ---
SSLCertificateFile "/usr/local/httpd/conf/ssl/server.crt"
SSLCertificateKeyFile "/usr/local/httpd/conf/ssl/server.key"
--- END ---
####################################################
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
##### TOMCAT #####
http://www.opensourcecommunity.ph/apache/jakarta/
tar -zxf jakarta-tomcat-VERSION
cd jakarta-tomcat-VERSION
./configure
make
make install
##### If TOMCAT is already build #####
tar -zxf jakarta-tomcat-VERSION
mv jakarta-tomcat-VERSION /usr/local/tomcat
####################################################
##### TOMCAT CONNECTOR #####
http://www.opensourcecommunity.ph/apache/jakarta/tomcat-connectors/jk
tar -zxf jakarta-tomcat-connectors-jk-VERSION
cd jakarta-tomcat-connectors-jk-VERSION/jk/native
./buildconf.sh
./configure --with-apxs=/usr/local/httpd/bin/apxs
make
make install
##### edit httpd.conf & put the line: #####
vi /usr/local/httpd/conf/httpd.conf
--- SNIP --
# Tomcat Module
Include /usr/local/httpd/conf/mod_jk.conf
--- END ---
##### create mod_jk.conf & put the line: #####
# Tomcat Module
vi /usr/local/httpd/conf/mod_jk.conf
--- SNIP --
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /usr/local/httpd/conf/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /usr/local/httpd/logs/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /usr/local/httpd/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /examples/* worker1
--- END ---
##### create workers.properties (standard) & put the line: #####
vi /usr/local/httpd/conf/workers.properties
--- SNIP --
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
ps=/
worker.list=ajp12, ajp13
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=ajp12, ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line=start
# IBM JDK1.3
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
--- END ---
####################################################
##### MOD_PYTHON #####
http://www.opensourcecommunity.ph/apache/httpd/modpython/
./configure --with-apxs=/usr/local/httpd/bin/apxs
make
make install
####################################################
##### MOD_PERL #####
http://perl.apache.org/download/index.html
perl Makefile.PL MP_APXS=/usr/local/httpd/bin/apxs
make
make test
make install
##### edit httpd.conf & put the line #####
vi /usr/local/httpd/conf/httpd.conf
--- SNIP ---
# PERL module
LoadModule perl_module modules/mod_perl.so
--- END ---
####################################################
##### INSTALL MYSQL #####
tar -zxf mysql-version.tar.gz
mv mysql-version /usr/local/mysql
adduser mysql -d /usr/local/mysql/data -s /bin/false
chown -R mysql.mysql /usr/local/mysql/data*
####################################################
##### POSTGRESQL #####
http://postgresql.net
cd postgresqlVERSION
./configure --prefix=/usr/local/pgsql --without-readline
make
make install
adduser postgres -d /var/lib/pgsql -s /bin/false
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
####################################################
##### PHP XML RPC EPI #####
http://xmlrpc-epi.sourceforge.net/
tar -zxf xmlrpc-epi-version
cd xmlrpc-epi-version
./configure
make
make install
####################################################
##### LIB EXPAT #####
http://expat.sourceforge.net/
tar -zxf expat-version
cd expat-version
./configure
make
make install
####################################################
ln -s /usr/local/sbin/* /usr/sbin/
ln -s /usr/local/bin/* /usr/bin/
ln -s /usr/local/lib/* /usr/lib/
ln -s /usr/local/libexec/* /usr/libexec/
ln -s /usr/local/libexec/* /usr/bin/
ln -s /usr/local/include/* /usr/include/
####################################################
##### PHP 4 AS CGI #####
http://php.net
##### ORIG #####
####./configure --prefix=/usr/local/php4 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql-dir=/usr/local/mysql --with-pgsql-dir=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php4/cgi --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring
##### FOR CGI REMOVE APXS2 #####
./configure --prefix=/usr/local/php4 --exec-prefix=/usr/local/php4 --with-config-file-path=/usr/local/etc/php4 --with-mysql-dir=/usr/local/mysql --with-pgsql-dir=/usr/local/pgsql --with-pcre-regex=yes --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring --with-xmlrpc=/usr/local --with-openssl=/usr/local --with-openssl-dir=/usr/local
make
make install
mkdir -p /usr/local/etc/php4/
cp php.ini-dist /usr/local/etc/php4/php.ini
##### edit httpd.conf & put the line #####
vi /usr/local/httpd/conf/httpd.conf
--- SNIP ---
# comment php4 module if any
#LoadModule php4_module modules/libphp4.so
# directory index
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm
# PHP 4 as CGI
ScriptAlias /php-cgi/ "/usr/local/httpd/php-cgi/"
Action application/x-httpd-php4 "/php-cgi/php4"
AddHandler application/x-httpd-php4 .php4
<directory>
AllowOverride None
Options None
Order allow,deny
Allow from all
</directory>
--- END ---
mkdir /usr/local/httpd/php-cgi
cp /usr/local/php4/bin/php /usr/local/httpd/php-cgi/php4
chown apache.apache /usr/local/httpd/php-cgi/php4
chmod 755 /usr/local/httpd/php-cgi/php4
vi /usr/local/etc/php4/php.ini
##### edit php 4's php.ini & add this line #####
--- SNIP ---
; PHP4 as CGI
cgi.fix_pathinfo = 1 ; needed for CGI/FastCGI mode
--- END ---
####################################################
##### PHP 5 AS MODULE #####
http://php.net
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php5/ --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring --with-xmlrpc=/usr/local --with-openssl=/usr/local --with-openssl-dir=/usr/local
# Old configure
#./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql --with-pcre-regex=yes --with-config-file-path=/usr/local/etc/php5/ --with-curl --with-gd=/usr/local/gd-2.0 --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-pear --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --enable-force-cgi-redirect --enable-fastcgi --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --enable-cli --enable-calendar --enable-discard-path --enable-ctype --enable-pcntl --enable-posix --enable-session --enable-sockets --enable-tokenizer --enable-magic-quotes --enable-mbstring
make
make install
mkdir -p /usr/local/etc/php5/
cp php.ini-dist /usr/local/etc/php5/php.ini
vi /usr/local/httpd/conf/httpd.conf
##### edit httpd.conf & put the line: #####
--- SNIP ---
# directory index
DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm
# PHP5 as module
AddType application/x-httpd-php .php .php5 .php3 .phtml
AddType application/x-httpd-php-source .phps
--- END ---
ln -s /usr/local/php5/bin/* /usr/bin
ln -s /usr/local/php5/lib/* /usr/lib
ln -s /usr/local/php5/include/* /usr/include
####################################################
##### PHP XML RPC #####
http://phpxmlrpc.sourceforge.net/
cd xmlrpc-version
vi Makefile
--- SNIP ---
PHP=/usr/local/bin/php
PHPINCLUDEDIR=/usr/local/php5/lib
--- END ---
make install