Installing PHP5

Using DreamHost's PHP 5
PHP 5 was added to all plans by DreamHost as of June 2005.

DreamHost provides PHP 5 CLI binaries which are available for use from the shell commanded line. The paths for the default DreamHost PHP-CLI installed binaries are as follows:


 * PHP 5.2 - /usr/local/php5/bin/php
 * PHP 5.3 - /usr/local/php53/bin/php

You can confirm the exact version numbers in use by executing the selected binary from within the shell using the "-v" option, which will run the binary and return the version information.

If you've previously installed your own copy of PHP (for example, by following the instructions below), you'll also need to remove the appropriate AddHandler and Actions directives from your .htaccess file.

If you're using DreamHost's installed PEAR modules, make sure you watch out for this: PEAR breaks on upgrading to PHP5.

Some PHP applications like MediaWiki includes scripts that must be executed from the shell account, and since version 1.21.x MediaWiki requires PHP ≥ 5.3. PHP5 can be used from:

/usr/local/php53/bin/php

Or, for PHP 5.4:

/usr/local/php54/bin/php

The two above examples are the command to put in the bash shell.

PHP 5.3
PHP 5.3 is now available through the DreamHost Panel! To activate it, just head over to Manage Domains then Edit the domain you wan to activate it on. On the next page, look for "PHP Mode:". From there, you can select to use PHP 5.3 by default on your domain!

As an added bonus, it can now be pretty significantly customized, without needing to set up custom .htaccess files and all that mess! For more information on customizing PHP 5.3 configurations, see php.ini for PHP 5.3.

In light of this recent addition, install scripts should not be necessary for use with PHP 5.3.

Install script for PHP 5.4.x
If you get the following error "configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path" and you don't need PostgreSQL, take off these flags: --with-pgsql \ --with-pdo-pgsql \

If you are trying to use this for nginx on the dreamhost vps then you will need to do the follow:
 * Nginx and
 * Nginx

php5.4-install.sh

 * 1) php5.4-install.sh from http://wiki.dreamhost.com/Installing_PHP5
 * 2) Revision history:
 * 3) 2013-08-09 by Graham  for latest PHP 5.4 and APC 3.1.13.
 * 4) 2013-05-02 by Krishna Desai (http://krishnadesai.com) for latest version of libmcrypt
 * 5) 2012-10-05 by Leonid Komarovsky (http://leonid.komarovsky.info) for PHP 5.4 and latest version of Xdebug. Added PostgreSQL support.
 * 6) 2011-12-01 by David (deceifermedia.com) for latest package versioins, updated download links,
 * 7)      and for the MySQLi and PDO extensions to use mysqlnd instead of libmysql (highly recommended)
 * 8) 2010-07-03 by Andres (andrew67.com) for latest php, curl and openssl versions and enabling perl/pecl
 * 9) 2009-12-27 by Steven Rosato to fix PHP 5.3 Compile Error: Undefined References in dns.c
 * 10) 2009-09-24 by Christopher (heavymark.com) for latest source versions and incorrect url and addition of proper enabling of xmlrpc.
 * 11) 2009-08-05 by Andy (andy.hwang.tw) to correct typo on m4 extract command.
 * 12) 2009-07-28 by samutz (samutz.com) to include ZIP, XMLRPC,
 * 13)          and GNU M4 (previous version of script failed without it)
 * 14) 2009-07-24 by ercoppa (ercoppa.org) to convert this script for PHP 5.3 (with all features of dreamhost,
 * 15)          except kerberos) with Xdebug and APC
 * 16) 2009-05-24 by ksmoe to correct copying of correct PHP cgi file (php-cgi instead of php)
 * 17) 2009-04-25 by Daniel (whathuhstudios.com) for latest source versions
 * 18) 2007-11-24 by Andrew (ajmconsulting.net) to allow 3rd wget line to pass
 * 19)          MCRYPT version information (was set as static download file name previously.)
 * 20) 2006-12-25 by Carl McDade (hiveminds.co.uk) to allow memory limit and freetype


 * 1) Save the code to a file as *.sh
 * 2) Don't forget to chmod a+x it!

set -e
 * 1) Abort on any errors

export DOMAIN="example.com"
 * 1) The domain in which to install the PHP CGI script.

SRCDIR=${HOME}/php5.4-source
 * 1) Where do you want all this stuff built? I'd recommend picking a local filesystem.
 * 2) ***Don't pick a directory that already exists!***
 * 3) We clean up after ourselves at the end!

INSTALLDIR=${HOME}/php5.4
 * 1) And where should it be installed?

DISTDIR=${HOME}/dist
 * 1) Set DISTDIR to somewhere persistent, if you plan to muck around with this
 * 2) script and run it several times!

rm -rf $SRCDIR
 * 1) Pre-download clean up!!!!

PHP5="php-5.4.17" #MUST BE THE CURRENT VERSION CURL="curl-7.23.1" XDEBUG="xdebug-2.2.1" M4="m4-1.4.16" AUTOCONF="autoconf-2.68" CCLIENT="imap-2007f" #MUST BE THE CURRENT VERSION CCLIENT_DIR="imap-2007f" OPENSSL="openssl-1.0.0e" OPENSSL_DIR="openssl-1.0.0e" LIBMCRYPT="2.5.8" LIBTOOL="libtool-2.4.2" APC="APC-3.1.9"
 * 1) Update version information here.

PHPFEATURES="--prefix=${INSTALLDIR} \ --with-config-file-path=${INSTALLDIR}/etc/php5/${DOMAIN} \ --with-config-file-scan-dir=${INSTALLDIR}/etc/php5/${DOMAIN} \ --enable-fastcgi \ --bindir=$INSTALLDIR/bin \ --enable-force-cgi-redirect \ --enable-zip \ --enable-xmlrpc \ --with-xmlrpc \ --with-xml \ --with-freetype-dir=/usr \ --with-mhash=/usr \ --with-zlib-dir=/usr \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-curl=${INSTALLDIR} \ --with-gd \ --enable-gd-native-ttf \ --enable-memory-limit \ --enable-ftp \ --enable-exif \ --enable-sockets \ --enable-wddx \ --enable-sqlite-utf8 \ --enable-calendar \ --enable-mbstring \ --enable-mbregex \ --enable-bcmath \ --with-mysql=/usr \ --with-mysqli=mysqlnd \ --with-pear \ --with-gettext \ --with-pdo-mysql=mysqlnd \ --with-pgsql \ --with-pdo-pgsql \ --with-openssl=${INSTALLDIR} \ --with-xsl \ --with-ttf=/usr \ --with-xslt \ --with-xslt-sablot=/usr \ --with-dom-xslt=/usr \ --with-mcrypt=${INSTALLDIR} \ "
 * 1) What PHP features do you want enabled?
 * 1)  end of user-editable bits. Hopefully!

export PATH=${INSTALLDIR}/bin:$PATH
 * 1) Push the install dir's bin directory into the path

export EXTRA_LIBS="-lresolv"
 * 1) fix for PHP 5.3 Compile Error: Undefined References in dns.c

mkdir -p ${SRCDIR} mkdir -p ${INSTALLDIR} if [ ! -f ${DISTDIR} ] then mkdir -p ${DISTDIR} fi
 * 1) set up directories

cd ${DISTDIR}

if [ ! -f ${DISTDIR}/${PHP5}.tar.gz ] then wget -c http://us.php.net/get/${PHP5}.tar.gz/from/this/mirror/ mv index.html ${PHP5}.tar.gz fi
 * 1) Get all the required packages

if [ ! -f ${DISTDIR}/${CURL}.tar.gz ] then wget -c http://curl.haxx.se/download/${CURL}.tar.gz fi

if [ ! -f ${DISTDIR}/${M4}.tar.gz ] then wget -c http://ftp.gnu.org/gnu/m4/${M4}.tar.gz fi

if [ ! -f ${DISTDIR}/${AUTOCONF}.tar.gz ] then wget -c http://ftp.gnu.org/gnu/autoconf/${AUTOCONF}.tar.gz fi

if [ ! -f ${DISTDIR}/${XDEBUG}.tgz ] then wget -c http://xdebug.org/files/${XDEBUG}.tgz fi

if [ ! -f ${DISTDIR}/${CCLIENT}.tar.Z ] then wget -c ftp://ftp.cac.washington.edu/imap/${CCLIENT}.tar.Z fi

if [ ! -f ${DISTDIR}/${OPENSSL}.tar.gz ] then wget -c http://www.openssl.org/source/${OPENSSL}.tar.gz fi

if [ ! -f ${DISTDIR}/${LIBMCRYPT}.tar.gz ] then wget -c http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/${LIBMCRYPT}/libmcrypt-${LIBMCRYPT}.tar.gz fi

if [ ! -f ${DISTDIR}/${LIBTOOL}.tar.gz ] then wget -c http://ftp.gnu.org/gnu/libtool/${LIBTOOL}.tar.gz fi

if [ ! -f ${DISTDIR}/${APC}.tgz ] then wget -c http://pecl.php.net/get/${APC}.tgz fi

echo -- Unpacking downloaded archives. This process may take several minutes! --

cd ${SRCDIR}

echo Extracting ${PHP5}... tar xzf ${DISTDIR}/${PHP5}.tar.gz echo Done.
 * 1) Unpack them all

echo Extracting ${CURL}... tar xzf ${DISTDIR}/${CURL}.tar.gz echo Done.

echo Extracting ${M4}... tar xzf ${DISTDIR}/${M4}.tar.gz echo Done.

echo Extracting ${XDEBUG}... tar xzf ${DISTDIR}/${XDEBUG}.tgz echo Done.

echo Extracting ${AUTOCONF}... tar xzf ${DISTDIR}/${AUTOCONF}.tar.gz echo Done.

echo Extracting ${CCLIENT}... uncompress -cd ${DISTDIR}/${CCLIENT}.tar.Z |tar x echo Done.

echo Extracting ${OPENSSL}... uncompress -cd ${DISTDIR}/${OPENSSL}.tar.gz |tar x echo Done.

echo Extracting ${LIBMCRYPT}... tar xzf ${DISTDIR}/libmcrypt-${LIBMCRYPT}.tar.gz echo Done.

echo Extracting ${LIBTOOL}... tar xzf ${DISTDIR}/${LIBTOOL}.tar.gz echo Done.

echo Extracting ${APC}... tar xzf ${DISTDIR}/${APC}.tgz echo Done.


 * 1) Build them in the required order to satisfy dependencies

echo ################### echo Compile CURL echo ################### cd ${SRCDIR}/${CURL} ./configure --enable-ipv6 --enable-cookies \ --enable-crypto-auth --prefix=${INSTALLDIR} make clean make make install
 * 1) cURL

echo ################### echo Compile M4 echo ################### cd ${SRCDIR}/${M4} ./configure --prefix=${INSTALLDIR} make clean make make install
 * M4

echo ################### echo Compile CCLIENT echo ################### cd ${SRCDIR}/${CCLIENT_DIR} make ldb cp c-client/c-client.a ${INSTALLDIR}/lib/libc-client.a cp c-client/*.h ${INSTALLDIR}/include
 * 1) CCLIENT
 * 1) Install targets are for wusses!

echo ################### echo Compile OPENSSL echo ################### cd ${SRCDIR}/${OPENSSL_DIR} ./config --prefix=${INSTALLDIR} make make install
 * 1) OPENSSL
 * 1) openssl

echo ################### echo Compile LIBMCRYPT echo ################### cd ${SRCDIR}/libmcrypt-${LIBMCRYPT} ./configure --disable-posix-threads --prefix=${INSTALLDIR} make make install
 * 1) LIBMCRYPT
 * 1) make clean

echo ################### echo Compile LIBTOOL echo ################### cd ${SRCDIR}/${LIBTOOL} ./configure --prefix=${INSTALLDIR} make clean make make install
 * 1) LIBTOOL

echo ################### echo Compile PHP echo ################### cd ${SRCDIR}/${PHP5} ./configure ${PHPFEATURES} make make install
 * 1) PHP 5
 * 1) make clean

mkdir -p ${INSTALLDIR}/etc/php5/${DOMAIN} cp ${SRCDIR}/${PHP5}/php.ini-production ${INSTALLDIR}/etc/php5/${DOMAIN}/php.ini
 * 1) Copy a basic configuration for PHP

echo ################### echo Compile AUTOCONF echo ################### cd ${SRCDIR}/${AUTOCONF} ./configure --prefix=${INSTALLDIR} make make install
 * 1) AUTOCONF
 * 1) make clean

echo ################### echo Compile XDEBUG echo ################### cd ${SRCDIR}/${XDEBUG} export PHP_AUTOHEADER=${INSTALLDIR}/bin/autoheader export PHP_AUTOCONF=${INSTALLDIR}/bin/autoconf echo $PHP_AUTOHEADER echo $PHP_AUTOCONF ${INSTALLDIR}/bin/phpize ./configure --enable-xdebug --with-php-config=${INSTALLDIR}/bin/php-config --prefix=${INSTALLDIR} make mkdir -p ${INSTALLDIR}/extensions cp modules/xdebug.so ${INSTALLDIR}/extensions
 * 1) XDEBUG
 * 1) make clean

echo "zend_extension=${INSTALLDIR}/extensions/xdebug.so" >> ${INSTALLDIR}/etc/php5/${DOMAIN}/xdebug.ini

echo ################### echo Compile APC echo ################### cd ${SRCDIR}/${APC} ${INSTALLDIR}/bin/phpize ./configure --enable-apc --enable-apc-mmap --with-php-config=${INSTALLDIR}/bin/php-config --
 * 1) APC

prefix=${INSTALLDIR} make cp modules/apc.so ${INSTALLDIR}/extensions echo "extension=${INSTALLDIR}/extensions/apc.so" >> ${INSTALLDIR}/etc/php5/${DOMAIN}/apc.ini
 * 1) make clean

mkdir -p ${HOME}/${DOMAIN}/cgi-bin chmod 0755 ${HOME}/${DOMAIN}/cgi-bin cp ${INSTALLDIR}/bin/php-cgi ${HOME}/${DOMAIN}/cgi-bin/php.cgi rm -rf $SRCDIR $DISTDIR
 * 1) Copy PHP CGI

if [ -f ${HOME}/${DOMAIN}/.htaccess ] then echo # echo '#####################################################################' echo ' Your domain already has a .htaccess, it is ranamed .htaccess_old   ' echo '              --> PLEASE FIX THIS PROBLEM <--                       ' echo '#####################################################################' echo # mv ${HOME}/${DOMAIN}/.htaccess ${HOME}/${DOMAIN}/.htaccess_old fi
 * 1) Create .htaccess

echo 'Options +ExecCGI' >> ${HOME}/${DOMAIN}/.htaccess echo 'AddHandler php-cgi .php' >> ${HOME}/${DOMAIN}/.htaccess echo 'Action php-cgi /cgi-bin/php.cgi' >> ${HOME}/${DOMAIN}/.htaccess echo '' >> ${HOME}/${DOMAIN}/.htaccess echo '' >> ${HOME}/${DOMAIN}/.htaccess echo 'Order Deny,Allow' >> ${HOME}/${DOMAIN}/.htaccess echo 'Deny from All' >> ${HOME}/${DOMAIN}/.htaccess echo 'Allow from env=REDIRECT_STATUS' >> ${HOME}/${DOMAIN}/.htaccess echo '' >> ${HOME}/${DOMAIN}/.htaccess

echo -- INSTALL COMPLETE! -- echo echo 'Configuration files:' echo "1) General PHP -> ${INSTALLDIR}/etc/php5/${DOMAIN}/php.ini" echo "2) Xdebug conf -> ${INSTALLDIR}/etc/php5/${DOMAIN}/xdebug.ini" echo "3) APC conf -> ${INSTALLDIR}/etc/php5/${DOMAIN}/apc.ini" echo echo 'You have to modify these files in order to enable Xdebug or APC features.'

exit 0

Install script for PHP 5.5.x
If you get the following error "configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path" and you don't need PostgreSQL, take off these flags: --with-pgsql \ --with-pdo-pgsql \

This has not been tested with nginx, but perhaps the following still apply as follows: If you are trying to use this for nginx on the dreamhost vps then you will need to do the following:
 * Nginx and
 * Nginx

php5.5-install.sh

 * 1) php5.5-install.sh from http://wiki.dreamhost.com/Installing_PHP5
 * 2) Revision history:
 * 3) 2014-06-14 by Andrew  for latest PHP 5.5 and modules
 * 4) 2013-08-09 by Graham  for latest PHP 5.4 and APC 3.1.13.
 * 5) 2013-05-02 by Krishna Desai (http://krishnadesai.com) for latest version of libmcrypt
 * 6) 2012-10-05 by Leonid Komarovsky (http://leonid.komarovsky.info) for PHP 5.4 and latest version of Xdebug. Added PostgreSQL support.
 * 7) 2011-12-01 by David (deceifermedia.com) for latest package versioins, updated download links,
 * 8)      and for the MySQLi and PDO extensions to use mysqlnd instead of libmysql (highly recommended)
 * 9) 2010-07-03 by Andres (andrew67.com) for latest php, curl and openssl versions and enabling perl/pecl
 * 10) 2009-12-27 by Steven Rosato to fix PHP 5.3 Compile Error: Undefined References in dns.c
 * 11) 2009-09-24 by Christopher (heavymark.com) for latest source versions and incorrect url and addition of proper enabling of xmlrpc.
 * 12) 2009-08-05 by Andy (andy.hwang.tw) to correct typo on m4 extract command.
 * 13) 2009-07-28 by samutz (samutz.com) to include ZIP, XMLRPC,
 * 14)          and GNU M4 (previous version of script failed without it)
 * 15) 2009-07-24 by ercoppa (ercoppa.org) to convert this script for PHP 5.3 (with all features of dreamhost,
 * 16)          except kerberos) with Xdebug and APC
 * 17) 2009-05-24 by ksmoe to correct copying of correct PHP cgi file (php-cgi instead of php)
 * 18) 2009-04-25 by Daniel (whathuhstudios.com) for latest source versions
 * 19) 2007-11-24 by Andrew (ajmconsulting.net) to allow 3rd wget line to pass
 * 20)          MCRYPT version information (was set as static download file name previously.)
 * 21) 2006-12-25 by Carl McDade (hiveminds.co.uk) to allow memory limit and freetype


 * 1) Save the code to a file as *.sh
 * 2) Don't forget to chmod a+x it!

set -e
 * 1) Abort on any errors

export DOMAIN="standingmist.com"
 * 1) The domain in which to install the PHP CGI script.

SRC_DIR=${HOME}/php5.5-source
 * 1) Where do you want all this stuff built? I'd recommend picking a local filesystem.
 * 2) ***Don't pick a directory that already exists!***
 * 3) We clean up after ourselves at the end!


 * 1) # And where should it be installed?
 * 2) INSTALL_DIR=${HOME}/php5.5

INSTALL_DIR=${HOME}/php/php55
 * 1) And where should it be installed?

DIST_DIR=${HOME}/dist
 * 1) Set DIST_DIR to somewhere persistent, if you plan to muck around with this
 * 2) script and run it several times!

rm -rf ${SRC_DIR}
 * 1) Pre-download clean up!!!!

PHP5="php-5.5.13" #MUST BE THE CURRENT VERSION CURL="curl-7.37.0" XDEBUG="xdebug-2.2.5" M4="m4-1.4.17" AUTOMAKE="automake-1.14.1" AUTOCONF="autoconf-2.69" CCLIENT="imap-2007f" #MUST BE THE CURRENT VERSION CCLIENT_DIR="imap-2007f" OPENSSL="openssl-1.0.1g" OPENSSL_DIR="openssl-1.0.1g" LIBMCRYPT_VER="2.5.8" LIBMCRYPT="libmcrypt-${LIBMCRYPT_VER}" LIBTOOL="libtool-2.4.2" BISON="bison-3.0.2" FLEX_VER="2.5.4.a" FLEX_FILE="flex-2.5.4" FLEX="${FLEX_FILE}a" RE2C_VER="0.13.6" RE2C="re2c-${RE2C_VER}"
 * 1) Update version information here.

PHPFEATURES="--prefix=${INSTALL_DIR} \ --with-config-file-path=${INSTALL_DIR}/etc/php5 \ --with-config-file-scan-dir=${INSTALL_DIR}/etc/php5/conf.d \ --enable-fastcgi \ --bindir=${INSTALL_DIR}/bin \ --enable-force-cgi-redirect \ --enable-zip \ --enable-xmlrpc \ --with-xmlrpc \ --with-xml \ --with-freetype-dir=/usr \ --with-mhash=/usr \ --with-zlib-dir=/usr \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-curl=${INSTALL_DIR} \ --with-gd \ --enable-gd-native-ttf \ --enable-memory-limit \ --enable-ftp \ --enable-exif \ --enable-sockets \ --enable-wddx \ --enable-sqlite-utf8 \ --enable-calendar \ --enable-mbstring \ --enable-mbregex \ --enable-bcmath \ --with-mysql=/usr \ --with-mysqli=mysqlnd \ --with-pear \ --with-gettext \ --with-pdo-mysql=mysqlnd \ --with-pgsql \ --with-pdo-pgsql \ --with-openssl=${INSTALLDIR} \ --with-xsl \ --with-ttf=/usr \ --with-xslt \ --with-xslt-sablot=/usr \ --with-dom-xslt=/usr \ --with-mcrypt=${INSTALL_DIR} \ "
 * 1) What PHP features do you want enabled?
 * 1)  end of user-editable bits. Hopefully!

export PATH=${INSTALL_DIR}/bin:$PATH
 * 1) Push the install dir's bin directory into the path

export EXTRA_LIBS="-lresolv"
 * 1) fix for PHP 5.3 Compile Error: Undefined References in dns.c

mkdir -p ${SRC_DIR} mkdir -p ${INSTALL_DIR} if [ ! -f ${DIST_DIR} ] then mkdir -p ${DIST_DIR} fi
 * 1) set up directories

cd ${DIST_DIR}

echo 'Downloading PHP' if [ ! -f ${DIST_DIR}/${PHP5}.tar.gz ] then wget -c http://us.php.net/get/${PHP5}.tar.gz/from/this/mirror/ mv index.html ${PHP5}.tar.gz else echo 'Skipping: PHP already downloaded' fi
 * 1) Get all the required packages

echo 'Downloading CURL' if [ ! -f ${DIST_DIR}/${CURL}.tar.gz ] then wget -c http://curl.haxx.se/download/${CURL}.tar.gz else echo 'Skipping: CURL already downloaded' fi

echo 'Downloading XDEBUG' if [ ! -f ${DIST_DIR}/${XDEBUG}.tgz ] then wget -c http://xdebug.org/files/${XDEBUG}.tgz else echo 'Skipping: XDEBUG already downloaded' fi

echo 'Downloading M4' if [ ! -f ${DIST_DIR}/${M4}.tar.gz ] then wget -c http://ftp.gnu.org/gnu/m4/${M4}.tar.gz else echo 'Skipping: M4 already downloaded' fi

echo 'Downloading AUTOMAKE' if [ ! -f ${DIST_DIR}/${AUTOMAKE}.tar.gz ] then wget -c http://ftp.gnu.org/gnu/automake/${AUTOMAKE}.tar.gz else echo 'Skipping: AUTOMAKE already downloaded' fi

echo 'Downloading AUTOCONF' if [ ! -f ${DIST_DIR}/${AUTOCONF}.tar.gz ] then wget -c http://ftp.gnu.org/gnu/autoconf/${AUTOCONF}.tar.gz else echo 'Skipping: AUTOCONF already downloaded' fi

echo 'Downloading CCLIENT' if [ ! -f ${DIST_DIR}/${CCLIENT}.tar.Z ] then wget -c ftp://ftp.cac.washington.edu/imap/${CCLIENT}.tar.Z else echo 'Skipping: CCLIENT already downloaded' fi

echo 'Downloading OPENSSL' if [ ! -f ${DIST_DIR}/${OPENSSL}.tar.gz ] then wget -c http://www.openssl.org/source/${OPENSSL}.tar.gz else echo 'Skipping: OPENSSL already downloaded' fi

echo 'Downloading LIBMCRYPT' if [ ! -f ${DIST_DIR}/${LIBMCRYPT}.tar.gz ] then wget -c http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/${LIBMCRYPT_VER}/${LIBMCRYPT}.tar.gz else echo 'Skipping: LIBMCRYPT already downloaded' fi

echo 'Downloading LIBTOOL' if [ ! -f ${DIST_DIR}/${LIBTOOL}.tar.gz ] then wget -c http://ftp.gnu.org/gnu/libtool/${LIBTOOL}.tar.gz else echo 'Skipping: LIBTOOL already downloaded' fi

echo 'Downloading BISON' if [ ! -f ${DIST_DIR}/${BISON}.tar.gz ] then wget -c http://ftp.gnu.org/gnu/bison/${BISON}.tar.gz else echo 'Skipping: BISON already downloaded' fi

echo 'Downloading FLEX' if [ ! -f ${DIST_DIR}/${FLEX}.tar.gz ] then wget -c http://downloads.sourceforge.net/project/flex/flex/${FLEX_VER}/${FLEX}.tar.gz else echo 'Skipping: FLEX already downloaded' fi

echo 'Downloading RE2C' if [ ! -f ${DIST_DIR}/${RE2C}.tar.gz ] then wget -c http://downloads.sourceforge.net/project/re2c/re2c/${RE2C_VER}/${RE2C}.tar.gz else echo 'Skipping: RE2C already downloaded' fi

echo '-- Unpacking downloaded archives. This process may take several minutes! --'

cd ${SRC_DIR} rm -rf *

echo "Extracting ${PHP5}..." tar xzf ${DIST_DIR}/${PHP5}.tar.gz echo 'Done.'
 * 1) Unpack them all

echo "Extracting ${CURL}..." tar xzf ${DIST_DIR}/${CURL}.tar.gz echo 'Done.'

echo "Extracting ${XDEBUG}..." tar xzf ${DIST_DIR}/${XDEBUG}.tgz echo 'Done.'

echo "Extracting ${M4}..." tar xzf ${DIST_DIR}/${M4}.tar.gz echo 'Done.'

echo "Extracting ${AUTOMAKE}..." tar xzf ${DIST_DIR}/${AUTOMAKE}.tar.gz echo 'Done.'

echo "Extracting ${AUTOCONF}..." tar xzf ${DIST_DIR}/${AUTOCONF}.tar.gz echo 'Done.'

echo "Extracting ${CCLIENT}..." uncompress -cd ${DIST_DIR}/${CCLIENT}.tar.Z |tar x echo 'Done.'

echo "Extracting ${OPENSSL}..." uncompress -cd ${DIST_DIR}/${OPENSSL}.tar.gz |tar x echo 'Done.'

echo "Extracting ${LIBMCRYPT}..." tar xzf ${DIST_DIR}/${LIBMCRYPT}.tar.gz echo 'Done.'

echo "Extracting ${LIBTOOL}..." tar xzf ${DIST_DIR}/${LIBTOOL}.tar.gz echo 'Done.'

echo "Extracting ${BISON}..." tar xzf ${DIST_DIR}/${BISON}.tar.gz echo 'Done.'

echo "Extracting ${FLEX}..." tar xzf ${DIST_DIR}/${FLEX}.tar.gz echo 'Done.'

echo "Extracting ${RE2C}..." tar xzf ${DIST_DIR}/${RE2C}.tar.gz echo 'Done.'


 * 1) Build them in the required order to satisfy dependencies

echo '###################' echo 'Compile CURL' echo '###################' cd ${SRC_DIR}/${CURL} ./configure --enable-ipv6 --enable-cookies \ --enable-crypto-auth --prefix=${INSTALL_DIR} make make install
 * 1) cURL

echo '###################' echo 'Compile M4' echo '###################' cd ${SRC_DIR}/${M4} ./configure --prefix=${INSTALL_DIR} make make install
 * M4

echo '###################' echo 'Compile CCLIENT' echo '###################' cd ${SRC_DIR}/${CCLIENT_DIR} make ldb<<EOCCLIENT y EOCCLIENT cp c-client/c-client.a ${INSTALL_DIR}/lib/libc-client.a cp c-client/*.h ${INSTALL_DIR}/include
 * 1) CCLIENT
 * 1) Install targets are for wusses!

echo '###################' echo 'Compile OPENSSL' echo '###################' cd ${SRC_DIR}/${OPENSSL_DIR} ./config --prefix=${INSTALL_DIR} make make install
 * 1) OPENSSL
 * 1) openssl

echo '###################' echo 'Compile LIBMCRYPT' echo '###################' cd ${SRC_DIR}/${LIBMCRYPT} ./configure --disable-posix-threads --prefix=${INSTALL_DIR} make make install
 * 1) LIBMCRYPT

echo '###################' echo 'Compile LIBTOOL' echo '###################' cd ${SRC_DIR}/${LIBTOOL} ./configure --prefix=${INSTALL_DIR} make make install
 * 1) LIBTOOL

echo '###################' echo 'Compile FLEX' echo '###################' cd ${SRC_DIR}/${FLEX_FILE} ./configure --prefix=${INSTALL_DIR} make make install
 * 1) FLEX

echo '###################' echo 'Compile BISON' echo '###################' cd ${SRC_DIR}/${BISON} ./configure --prefix=${INSTALL_DIR} make make install
 * 1) BISON

echo '###################' echo 'Compile RE2C' echo '###################' cd ${SRC_DIR}/${RE2C} ./configure --prefix=${INSTALL_DIR} make make install
 * 1) RE2C

echo '###################' echo 'Compile AUTOMAKE' echo '###################' cd ${SRC_DIR}/${AUTOMAKE} ./configure --prefix=${INSTALL_DIR} make make install
 * 1) AUTOMAKE

echo '###################' echo 'Compile AUTOCONF' echo '###################' cd ${SRC_DIR}/${AUTOCONF} ./configure --prefix=${INSTALL_DIR} make make install
 * 1) AUTOCONF

echo '###################' echo 'Compile PHP' echo '###################' cd ${SRC_DIR}/${PHP5} ./configure ${PHPFEATURES} make make install
 * 1) PHP 5

mkdir -p ${INSTALL_DIR}/etc/php5/${DOMAIN} cp ${SRC_DIR}/${PHP5}/php.ini-production ${INSTALL_DIR}/etc/php5/${DOMAIN}/php.ini
 * 1) Copy a basic configuration for PHP

echo '###################' echo 'Compile XDEBUG' echo '###################' cd ${SRC_DIR}/${XDEBUG} export PHP_AUTOHEADER=${INSTALL_DIR}/bin/autoheader export PHP_AUTOCONF=${INSTALL_DIR}/bin/autoconf echo "$PHP_AUTOHEADER" echo "$PHP_AUTOCONF" ${INSTALL_DIR}/bin/phpize ./configure --enable-xdebug --with-php-config=${INSTALL_DIR}/bin/php-config --prefix=${INSTALL_DIR} make mkdir -p ${INSTALL_DIR}/extensions cp modules/xdebug.so ${INSTALL_DIR}/extensions
 * 1) XDEBUG
 * 1) make clean

echo "zend_extension=${INSTALL_DIR}/extensions/xdebug.so" >> ${INSTALL_DIR}/etc/php5/${DOMAIN}/xdebug.ini

mkdir -p ${HOME}/${DOMAIN}/cgi-bin chmod 0755 ${HOME}/${DOMAIN}/cgi-bin cp ${INSTALL_DIR}/bin/php-cgi ${HOME}/${DOMAIN}/cgi-bin/php.cgi rm -rf $SRC_DIR $DIST_DIR
 * 1) Copy PHP CGI

if [ -f ${HOME}/${DOMAIN}/.htaccess ] then echo # echo '#####################################################################' echo ' Your domain already has a .htaccess, it is ranamed .htaccess_old   ' echo '              --> PLEASE FIX THIS PROBLEM <--                       ' echo '#####################################################################' echo # mv ${HOME}/${DOMAIN}/.htaccess ${HOME}/${DOMAIN}/.htaccess_old fi
 * 1) Create .htaccess

echo 'Options +ExecCGI' >> ${HOME}/${DOMAIN}/.htaccess echo 'AddHandler php-cgi .php' >> ${HOME}/${DOMAIN}/.htaccess echo 'Action php-cgi /cgi-bin/php.cgi' >> ${HOME}/${DOMAIN}/.htaccess echo '' >> ${HOME}/${DOMAIN}/.htaccess echo '' >> ${HOME}/${DOMAIN}/.htaccess echo 'Order Deny,Allow' >> ${HOME}/${DOMAIN}/.htaccess echo 'Deny from All' >> ${HOME}/${DOMAIN}/.htaccess echo 'Allow from env=REDIRECT_STATUS' >> ${HOME}/${DOMAIN}/.htaccess echo '' >> ${HOME}/${DOMAIN}/.htaccess

echo '-- INSTALL COMPLETE! --' echo echo 'Configuration files:' echo "1) General PHP -> ${INSTALL_DIR}/etc/php5/${DOMAIN}/php.ini" echo "2) Xdebug conf -> ${INSTALL_DIR}/etc/php5/${DOMAIN}/xdebug.ini" echo echo 'You have to modify these files in order to enable Xdebug.'

exit 0