#!/bin/sh # # php5setup.cgi # # This script will Download, configure, build, and install php5 in your own directorty, # step by step, automatically. # # If there is a php5 binary already available, you don't need it # unless you want to have your own isntallation, somehow. # # # Put it into a protected directory and set permission of 755, then access it. # The path to php5 will be "/home/USER/bin/php" # If the directory structure in different, you need to edit this script. # # Modify PREFIX env variable to specify the directory of installation if needed. # # Modules included by default: This is output of "php -m" # Modify ./configure options if you want more or less modules # # [PHP Modules] # ctype # dom # iconv # libxml # mysql # pcre # posix # session # SimpleXML # SPL # SQLite # standard # tokenizer # xml # # [Zend Modules] # echo echo "======== php5 setup script ========" exec 2>&1 exitnow () { echo " Restart (F5) this script to coninue the setup" exit } _X=${HOME:="/home/${USER:=`whoami`}"} ##################################################################### # php5 binary will be placed in $PREFIX/bin, libs to $PREFIX/lib/php # "/home/USER" by default. Modify this as you wish PREFIX="$HOME" cd $HOME if [ ! -e php-5.0.4.tar.bz2 ] ; then echo "Source tarball not found. Downloading 'wget -nd http://ca.php.net/get/php-5.0.4.tar.bz2/from/us3.php.net/mirror' ..." wget -nd http://ca.php.net/get/php-5.0.4.tar.bz2/from/us3.php.net/mirror exitnow fi if [ ! -d php-5.0.4 ] ; then echo "Source directory not found. Extracting 'tar -xjvf php-5.0.4.tar.bz2' ..." tar -xjvf php-5.0.4.tar.bz2 exitnow fi cd php-5.0.4 if [ ! -e Makefile ] ; then echo "Makefile not found. Running './configure --prefix=$HOME' ..." # # ADD configure options as you wish. # ./configure --prefix=$HOME # Example: # # ./configure --prefix=$HOME --enable-force-cgi-redirect --with-mysql\ #--with-zlib --with-zip --with-bz2 --with-iconv\ #--with-openssl --enable-versioning --with-enabled-local-infile\ #--with-dbase --enable-ftp\ #--with-imap --with-imap-ssl --enable-shmop\ #--with-gd --enable-gd-native-ttf --with-ttf --with-freetype-dir --with-jpeg-dir\ #--enable-mbstring --enable-xslt --with-xslt-sablot\ #--with-gettext --with-curl --with-mcrypt --with-dom --with-dom-xslt\ #--with-mhash --enable-exif --enable-bcmath\ #--enable-calendar --enable-soap --enable-xslt --with-xslt-sablot\ #--enable-sockets --with-xsl --enable-wddx # # Note: You may have to download and build some of library if it's not on the server. # # will tell you the options used for the given php installation. # exitnow fi if [ ! -e main/internal_functions.o ] ; then echo "php5 binary not found. Running 'make' ..." make exitnow fi if [ ! -e $HOME/bin/php ] ; then echo "php5 installation not found. Running 'make install' ..." make install fi echo " All done. Test run php5 : '$HOME/bin/php' ... " $HOME/bin/php 2>&1 # end