How to enable multiple PHP versions in Parallels Plesk for Linux

php-5.4.30

==========
1. Login to VPS via SSH

2. Download and extract the php source files. Use wget to download the php source gzip file. Check the version in the link

cd /tmp
wget http://hk1.php.net/distributions/php-5.4.30.tar.gz
tar zxf php-5.4.30.tar.gz
cd php-5.4.30/

3. Configure and compile PHP

./configure ‘–with-libdir=lib64’ ‘–cache-file=../config.cache’ ‘–prefix=/usr/local/php540-cgi’ ‘–with-config-file-path=/usr/local/php540-cgi/etc’ ‘–disable-debug’ ‘–with-pic’ ‘–disable-rpath’ ‘–with-bz2’ ‘–with-curl’ ‘–with-freetype-dir=/usr/local/php540-cgi’ ‘–with-png-dir=/usr/local/php540-cgi’ ‘–enable-gd-native-ttf’ ‘–without-gdbm’ ‘–with-gettext’ ‘–with-gmp’ ‘–with-iconv’ ‘–with-jpeg-dir=/usr/local/php540-cgi’ ‘–with-openssl’ ‘–with-pspell’ ‘–with-pcre-regex’ ‘–with-zlib’ ‘–enable-exif’ ‘–enable-ftp’ ‘–enable-sockets’ ‘–enable-sysvsem’ ‘–enable-sysvshm’ ‘–enable-sysvmsg’ ‘–enable-wddx’ ‘–with-kerberos’ ‘–with-unixODBC=/usr’ ‘–enable-shmop’ ‘–enable-calendar’ ‘–without-sqlite3’ ‘–with-libxml-dir=/usr/local/php540-cgi’ ‘–enable-pcntl’ ‘–with-imap’ ‘–with-imap-ssl’ ‘–enable-mbstring’ ‘–enable-mbregex’ ‘–with-gd’ ‘–enable-bcmath’ ‘–with-xmlrpc’ ‘–with-ldap’ ‘–with-ldap-sasl’ ‘–with-mysql=/usr’ ‘–with-mysqli’ ‘–with-snmp’ ‘–enable-soap’ ‘–with-xsl’ ‘–enable-xmlreader’ ‘–enable-xmlwriter’ ‘–enable-pdo’ ‘–with-pdo-mysql’ ‘–with-pdo-pgsql’ ‘–with-pear=/usr/local/php540-cgi/pear’ ‘–with-mcrypt’ ‘–enable-intl’ ‘–without-pdo-sqlite’ ‘–with-config-file-scan-dir=/usr/local/php540-cgi/php.d’

make

make install

4. Copy the php.ini file

cp /etc/php.ini /usr/local/php540-cgi/etc/php.ini

5. Register new PHP under Plesk

/usr/local/psa/bin/php_handler –add -displayname 5.4.30-custom -path /usr/local/php540-cgi/bin/php-cgi -phpini /usr/local/php540-cgi/etc/php.ini -type cgi -id 5.4.30-custom

PHP 5.2 ( download the package php-5.2.17.tar.gz and follow the same steps change only 3, 5 and 6)

===========

Install build-dependencies for PHP:

yum -y install gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel libmcrypt-devel unixODBC-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel

3. ./configure –with-libdir=lib64 –cache-file=./config.cache –prefix=/usr/local/php-5.2.17 –with-config-file-path=/usr/local/php-5.2.17/etc –disable-debug –with-pic –disable-rpath  –with-bz2 –with-curl –with-freetype-dir=/usr/local/php-5.2.17 –with-png-dir=/usr/local/php-5.2.17 –enable-gd-native-ttf –without-gdbm –with-gettext –with-gmp –with-iconv –with-jpeg-dir=/usr/local/php-5.2.17 –with-openssl –with-pspell –with-pcre-regex –with-zlib –enable-exif –enable-ftp –enable-sockets –enable-sysvsem –enable-sysvshm –enable-sysvmsg –enable-wddx –with-kerberos –with-unixODBC=/usr –enable-shmop –enable-calendar –with-libxml-dir=/usr/local/php-5.2.17 –enable-pcntl –with-imap –with-imap-ssl –enable-mbstring –enable-mbregex –with-gd –enable-bcmath –with-xmlrpc –with-ldap –with-ldap-sasl –with-mysql=/usr –with-mysqli –with-snmp –enable-soap –with-xsl –enable-xmlreader –enable-xmlwriter –enable-pdo –with-pdo-mysql –with-pdo-pgsql –with-pear=/usr/local/php-5.2.17/pear –with-mcrypt –without-pdo-sqlite –with-config-file-scan-dir=/usr/local/php-5.2.17/php.d –enable-fastcgi # Running the configure script

5. cp /usr/local/src/php-5.2.17/php.ini-recommended /usr/local/php-5.2.17/etc/php.ini # We create a default php.ini for 5.2.17

6. /usr/local/psa/bin/php_handler –add -displayname “5.2.17” -path /usr/local/php-5.2.17/bin/php-cgi -phpini /usr/local/php-5.2.17/etc/php.ini -type fastcgi -id “fastcgi-5.2.17” # And finally we register PHP 5.2.17 with Plesk

PHP 5.3 ( download the package php-5.3.27.tar.gz and follow the same steps change only 3, 5 and 6)

==========

3. ./configure –with-libdir=lib64 –cache-file=./config.cache –prefix=/usr/local/php-5.3.27 –with-config-file-path=/usr/local/php-5.3.27/etc –disable-debug –with-pic –disable-rpath  –with-bz2 –with-curl –with-freetype-dir=/usr/local/php-5.3.27 –with-png-dir=/usr/local/php-5.3.27 –enable-gd-native-ttf –without-gdbm –with-gettext –with-gmp –with-iconv –with-jpeg-dir=/usr/local/php-5.3.27 –with-openssl –with-pspell –with-pcre-regex –with-zlib –enable-exif –enable-ftp –enable-sockets –enable-sysvsem –enable-sysvshm –enable-sysvmsg –enable-wddx –with-kerberos –with-unixODBC=/usr –enable-shmop –enable-calendar –with-libxml-dir=/usr/local/php-5.3.27 –enable-pcntl –with-imap –with-imap-ssl –enable-mbstring –enable-mbregex –with-gd –enable-bcmath –with-xmlrpc –with-ldap –with-ldap-sasl –with-mysql=/usr –with-mysqli –with-snmp –enable-soap –with-xsl –enable-xmlreader –enable-xmlwriter –enable-pdo –with-pdo-mysql –with-pdo-pgsql –with-pear=/usr/local/php-5.3.27/pear –with-mcrypt –without-pdo-sqlite –with-config-file-scan-dir=/usr/local/php-5.3.27/php.d –without-sqlite3 –enable-intl # Running the configure script

5. cp -a /etc/php.ini /usr/local/php-5.3.27/etc/php.ini # We create a default php.ini for 5.3.27

6. /usr/local/psa/bin/php_handler –add -displayname “5.3.27” -path /usr/local/php-5.3.27/bin/php-cgi -phpini /usr/local/php-5.3.27/etc/php.ini -type fastcgi -id “fastcgi-5.3.27″# And finally we register PHP 5.3.27 with Plesk

To see a list of registered PHP handlers on a Plesk server, run this command:

[root@plesk ~]# /usr/local/psa/bin/php_handler --list

==
http://www.lifelinux.com/error-compiling-php-on-centos-x64/
==
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s