Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 20th September 2012, 18:59
pvanthony pvanthony is offline
Member
 
Join Date: Jun 2012
Location: Singapore
Posts: 39
Thanks: 6
Thanked 5 Times in 4 Posts
Send a message via Skype™ to pvanthony
Default How to install multiple versions of php to work with nginx.

Hi,

Currently using ispconfig 3 with nginx with php 5.3 on CentOS 6.

Now there is a requirement to run php 5.2 together with php 5.3.

Is there a way to do this using yum? If not, what other way can I get this done?

Your advice is greatly appreciated.

P.V.Anthony
Reply With Quote
Sponsored Links
  #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
  #3  
Old 2nd October 2012, 08:57
pvanthony pvanthony is offline
Member
 
Join Date: Jun 2012
Location: Singapore
Posts: 39
Thanks: 6
Thanked 5 Times in 4 Posts
Send a message via Skype™ to pvanthony
Default

Thank you very much for sharing this.

P.V.Anthony
Reply With Quote
  #4  
Old 25th January 2013, 05:36
coozila coozila is offline
Junior Member
 
Join Date: Oct 2012
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default fpm start error

[root@www php-5.2.17]# /etc/init.d/php-5.2.17-fpm start
Starting php-fpm Starting php_fpm Jan 25 04:26:37.161305 [ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool 'default'
................................... failed
failed
Reply With Quote
  #5  
Old 25th January 2013, 16:48
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

You must specify a user and group for the default pool.
__________________
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
  #6  
Old 2nd July 2013, 13:10
harkman harkman is offline
Junior Member
 
Join Date: Aug 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Hello.

I tried to install php 5.2.17 alonside default php 5.4 on a Nginx webserver

My problem now is, that the php-fpm pools in php 5.2 are not read. I found that the configuration files in 5.2 are in XML while 5.3 and up use ini-format.

Is there any way to tell ispConfig to create pool configs in XML?

I also tried to install 5.2 in fastcgi mode, but unfortunately latest ispconfig version has dropped fastcgi support for nginx.

Can someone give some advice hot to solve this?

Regards, Jürgen
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ISPConfig 3.0.3.3 fresh instalation - email tab is empty artur_gib Installation/Configuration 14 28th January 2014 20:02
Cron issue in Debian 6 Nolan Installation/Configuration 6 18th April 2011 17:36
Multiserver setup: repquota command not found. CSsab Installation/Configuration 2 27th January 2011 16:11
Error when install ISPConfig 2 with components built from source X-admin Installation/Configuration 5 30th April 2010 14:22
ISP Config hesitation when opening web pages frankb Installation/Configuration 7 15th December 2008 14:06


All times are GMT +2. The time now is 02:41.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.