Multiple versiuni PHP pentru ISPConfig 3

Vom instala PHP 5.3.26 and PHP 5.4.16 pe ispconfig, ultimele versiuni la momentul tutorialului: http://php.net/downloads.phpispconfig

mkdir /opt/php-5.3.26
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build

wget http://www.php.net/get/php-5.3.26.tar.bz2/from/ro1.php.net/mirror -O php-5.3.26.tar.bz2

cd php-5.3.26/

-instalam cele necesare:

apt-get -y install build-essential

apt-get -y build-dep php5

apt-get -y install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev

ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a

./configure \
–prefix=/opt/php-5.3.26 \
–with-pdo-pgsql \
–with-zlib-dir \
–with-freetype-dir \
–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 \
–with-openssl \
–with-fpm-user=www-data \
–with-fpm-group=www-data \
–with-libdir=/lib/x86_64-linux-gnu \
–enable-ftp \
–with-imap \
–with-imap-ssl \
–with-kerberos \
–with-gettext \
–enable-fpm

make
make install

cp /usr/local/src/php5-build/php-5.3.26/php.ini-production /opt/php-5.3.26/lib/php.ini

cp /opt/php-5.3.26/etc/php-fpm.conf.default /opt/php-5.3.26/etc/php-fpm.conf

vim /opt/php-5.3.26/etc/php-fpm.conf

[…]
pid = run/php-fpm.pid
[…]
user = www-data
group = www-data
[…]
listen = 127.0.0.1:8999
[…]
include=/opt/php-5.3.26/etc/pool.d/*.conf
[…]

mkdir /opt/php-5.3.26/etc/pool.d

-Creem scriptul de pornire al PHP-FPM:

vim /etc/init.d/php-5.3.26-fpm
[…]

#! /bin/sh
### BEGIN INIT INFO
# Provides:          php-5.3.22-fpm
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-5.3.22-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-5.3.22/sbin/php-fpm
php_fpm_CONF=/opt/php-5.3.22/etc/php-fpm.conf
php_fpm_PID=/opt/php-5.3.22/var/run/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 $php_opts
                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.3.26-fpm
insserv php-5.3.26-fpm

-Pornim PHP-FPM

/etc/init.d/php-5.3.26-fpm start

-este normal sa zica ca: WARNING: Nothing matches the include pattern ……..

– Acum instalam module

apt-get -y install php-pear

cd /opt/php-5.3.26/etc

pecl -C ./pear.conf update-channels

pecl -C ./pear.conf install apc

vim /opt/php-5.3.26/lib/php.ini
– si adaugam la sfarsitul fisierului:
[…]
extension=apc.so
apc.enabled=1
apc.shm_size=128M
apc.ttl=0
apc.user_ttl=600
apc.gc_ttl=600
apc.enable_cli=1
apc.mmap_file_mask=/tmp/apc.XXXXXX
;apc.mmap_file_mask=/dev/zero
;apc.shm_segments = 5

– instalam memcache:

pecl -C ./pear.conf install memcache

vim /opt/php-5.3.26/lib/php.ini

-si adaugam la sfarsit:

[…]
extension=memcache.so

apt-get -y install libmemcached-dev

pecl -C ./pear.conf install memcached

vim /opt/php-5.3.26/lib/php.ini

-si adaugam la sfarsit:

[…]
extension=memcached.so

-Instalam IonCube

cd /tmp

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz

cp ioncube/ioncube_loader_lin_5.3.so /opt/php-5.3.26/lib/php/extensions/no-debug-non-zts-20090626/ioncube.so

vim /opt/php-5.3.26/lib/php.ini

-si adaugam la inceputul fisierului:

zend_extension = /opt/php-5.3.22/lib/php/extensions/no-debug-non-zts-20090626/ioncube.so
[PHP]
[…]

/etc/init.d/php-5.3.26-fpm reload

PHP 5.4.16 (PHP-FPM)

mkdir /opt/php-5.4.16
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build

wget http://www.php.net/get/php-5.4.16.tar.bz2/from/ro1.php.net/mirror -O php-5.4.16.tar.bz2

tar jxf php-5.4.12.tar.bz2

cd php-5.4.16

apt-get install build-essential

apt-get build-dep php5

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

ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a

./configure \
–prefix=/opt/php-5.4.16 \
–with-pdo-pgsql \
–with-zlib-dir \
–with-freetype-dir \
–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 \
–with-openssl \
–with-fpm-user=www-data \
–with-fpm-group=www-data \
–with-libdir=/lib/x86_64-linux-gnu \
–enable-ftp \
–with-imap \
–with-imap-ssl \
–with-kerberos \
–with-gettext \
–enable-fpm

make
make install

cp /usr/local/src/php5-build/php-5.4.16/php.ini-production /opt/php-5.4.16/lib/php.ini

cp /opt/php-5.4.16/etc/php-fpm.conf.default /opt/php-5.4.16/etc/php-fpm.conf

vim /opt/php-5.4.16/etc/php-fpm.conf

[…]
pid = run/php-fpm.pid
[…]
user = www-data
group = www-data
[…]
listen = 127.0.0.1:8998
[…]
include=/opt/php-5.4.16/etc/pool.d/*.conf

mkdir /opt/php-5.4.16/etc/pool.d

– creem scriptul de pornire:

vim /etc/init.d/php-5.4.16-fpm

#! /bin/sh
### BEGIN INIT INFO
# Provides:          php-5.4.16-fpm
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-5.4.16-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-5.4.16/sbin/php-fpm
php_fpm_CONF=/opt/php-5.4.16/etc/php-fpm.conf
php_fpm_PID=/opt/php-5.4.16/var/run/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 $php_opts
                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.4.16-fpm
insserv php-5.4.16-fpm
/etc/init.d/php-5.4.16-fpm start

-E normal sa dea eroarea:  WARNING: Nothing matches the include pattern………..

cd /opt/php-5.4.16/etc/

pecl -C ./pear.conf update-channels

pecl -C ./pear.conf install apc

pecl -C ./pear.conf install memcache

apt-get install libmemcached-dev

pecl -C ./pear.conf install memcached

vim /opt/php-5.4.16/lib/php.ini

[...]
extension=apc.so
apc.enabled=1
apc.shm_size=128M
apc.ttl=0
apc.user_ttl=600
apc.gc_ttl=600
apc.enable_cli=1
apc.mmap_file_mask=/tmp/apc.XXXXXX
;apc.mmap_file_mask=/dev/zero
;apc.shm_segments = 5
extension=memcache.so
extension=memcached.so

cd /tmp

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz

cp ioncube/ioncube_loader_lin_5.4.so /opt/php-5.4.16/lib/php/extensions/no-debug-non-zts-20100525/ioncube.so
vim /opt/php-5.4.16/lib/php.ini

-Adaugam linia zend_extension = /opt/php-5.4.16/lib/php/extensions/no-debug-non-zts-20100525/ioncube.so ciar la inceputul fisierului (inainte de [PHP]):

zend_extension = /opt/php-5.4.16/lib/php/extensions/no-debug-non-zts-20100525/ioncube.so
[PHP]
[…]

/etc/init.d/php-5.4.16-fpm reload

 


 

Ultimele știri ispconfig:

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Zi cu cuvintele tale...