View Single Post
  #2  
Old 21st September 2012, 18:40
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

This is how it works on Ubuntu and Debian:

Code:
mkdir /opt/php-5.2.17
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget http://uk3.php.net/get/php-5.2.17.tar.bz2/from/this/mirror -O php-5.2.17.tar.bz2
tar jxf php-5.2.17.tar.bz2

wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | sudo patch -d php-5.2.17 -p1

cd php-5.2.17/

apt-get build-dep php5

apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev

ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/libjpeg.so
ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/libpng.so


./configure \
--prefix=/opt/php-5.2.17 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--enable-fpm \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl --with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip   \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--enable-fastcgi \
--with-pear \
--enable-memcache \
--with-openssl



http://zgadzaj.com/how-to-install-php-53-and-52-together-on-ubuntu-1204

This is due to PHP bug #54736, which could be easily resolved using patch debian_patches_disable_SSLv2_for_openssl_1_0_0.patch attached to that bug report.

Download this patch to your ~/Downloads/php-5.2.17 directory, and execute:

patch -p1 < debian_patches_disable_SSLv2_for_openssl_1_0_0.patch.patch



make
make install


cp /usr/local/src/php5-build/php-5.2.17/php.ini-recommended /opt/php-5.2.17/lib/php.ini




mkdir /opt/php-5.2.17/etc/pool.d
mkdir -p /opt/php-5.2.17/var/run


vi /etc/init.d/php-5.2.17-fpm
=========================
#! /bin/sh

### BEGIN INIT INFO
# Provides:          php-5.2.17-fpm
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-5.2.17-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO

php_fpm_BIN=/opt/php-5.2.17/sbin/php-fpm
php_fpm_CONF=/opt/php-5.2.17/etc/php-fpm.conf
php_fpm_PID=/opt/php-5.2.17/logs/php-fpm.pid

php_opts="--fpm-config $php_fpm_CONF"


wait_for_pid () {
        try=0
        while test $try -lt 35 ; do
                case "$1" in
                        'created')
                        if [ -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;

                        'removed')
                        if [ ! -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;
                esac

                echo -n .
                try=`expr $try + 1`
                sleep 1

        done
}
case "$1" in
        start)
                echo -n "Starting php-fpm "

                $php_fpm_BIN start

                if [ "$?" != 0 ] ; then
                        echo " failed"
                        exit 1
                fi

                wait_for_pid created $php_fpm_PID

                if [ -n "$try" ] ; then
                        echo " failed"
                        exit 1
                else
                        echo " done"
                fi
        ;;

        stop)
                echo -n "Gracefully shutting down php-fpm "

                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi

                kill -QUIT `cat $php_fpm_PID`

                wait_for_pid removed $php_fpm_PID

                if [ -n "$try" ] ; then
                        echo " failed. Use force-exit"
                        exit 1
                else
                        echo " done"
                       echo " done"
                fi
        ;;

        force-quit)
                echo -n "Terminating php-fpm "

                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi

                kill -TERM `cat $php_fpm_PID`

                wait_for_pid removed $php_fpm_PID

                if [ -n "$try" ] ; then
                        echo " failed"
                        exit 1
                else
                        echo " done"
                fi
        ;;

        restart)
                $0 stop
                $0 start
        ;;

        reload)

                echo -n "Reload service php-fpm "

                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi

                kill -USR2 `cat $php_fpm_PID`

                echo " done"
        ;;

        *)
                echo "Usage: $0 {start|stop|force-quit|restart|reload}"
                exit 1
        ;;

esac



chmod 755 /etc/init.d/php-5.2.17-fpm
insserv php-5.2.17-fpm

/etc/init.d/php-5.2.17-fpm start
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote