PHP Plesk

How to install and use two versions of PHP on the same Plesk for Linux server


php version – php-5.4.31

CentOS 6.5
Plesk Panel 12.0
Current php version 5.3

1. SSH to your Plesk server (or Apache Service Node for Parallels Plesk Automation) as root, download the PHP source, unpack it, and configure it:

# cd /usr/local/src
# mkdir php540
# cd php540
# wget
# tar xzvf php-5.4.0.tar.gz
# cd php-5.4.0
# ./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' '--enable-fastcgi' '--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'

Note: You MUST USE THE PREFIX SWITCH in order for your new PHP to be installed inside a single directory. As you can see, the prefix here is /usr/local/php540-cgi/

Note: Above are the sample command line arguments you may encounter with errors regarding the absence of a package (e.g. mysql-devel). The default arguments are described in the documentation

Choosing a prefix is very important because it prevents your new PHP installation from interfering with the other PHP installations available on the server.

Compile and install PHP:

# make
# make install

Set up php.ini:

# cp php.ini-development /usr/local/php540-cgi/php.ini

You can edit the php.ini file to set PHP options. If you prefer having php.ini in another location, run the configure utility with the option –with-config-file-path=/some/path in step #1.

Register the new PHP version:

In Parallels Plesk Panel

    /usr/local/psa/bin/php_handler --add -displayname  -path  -phpini  -type  -id 


-displayname is the PHP version name that will be shown in the Plesk UI. We recommend you include the version number in the displayname. For example, you could name the version “5.3.3-custom”.

-path is the location of the PHP CGI binary file. You can find this in the output of the command make install in the line Installing PHP CGI binary. For example, if you see the line Installing PHP CGI binary: /usr/local/bin/, the location you need to specify is /usr/local/bin/php-cgi. Learn more at the Official PHP web Site.

-phpini is the location of the php.ini file, for example, /some/path/php.ini .

-type is the type of the PHP handler associated with this version. Learn more about PHP handlers in the section: PHP Handlers.

Important: You can set either the CGI or FastCGI PHP handler. mod_php is not supported.
-id (optional) is the identifier you will use when referring to this PHP version (for example, when adjusting or removing it).

Compile errors.


#error: xml2-config not found. Please check your libxml2 installation


# yum install libxml2-devel


#configure: error: Cannot find OpenSSL's 


# yum install openssl-devel


# configure: error: Please reinstall the BZip2 distribution


# yum install bzip2-devel


# configure: error: jpeglib.h not found.


# yum install libjpeg-devel


# configure: error: png.h not found.


# yum install libpng-devel


# Configure: error: freetype.h not found.


# yum install freetype-devel


# Configure: error: Unable to locate gmp.h


# yum install gmp-devel


# configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.


# yum install libc-client-devel 

Error: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:

1. You have an upgrade for libc-client which is missing some
dependency that another package requires. Yum is trying to
solve this by installing an older version of libc-client of the
different architecture. If you exclude the bad architecture
yum will tell you what the root cause is (which package
requires what). You can try redoing the upgrade with
–exclude libc-client.otherarch … this should give you an error
message showing the root cause of the problem.

2. You have multiple architectures of libc-client installed, but
yum can only see an upgrade for one of those arcitectures.
If you don’t want/need both architectures anymore then you
can remove the one with the missing update and everything
will work.

3. You have duplicate versions of libc-client installed already.
You can use “yum check” to get yum show these errors.

…you can also use –setopt=protected_multilib=false to remove
this checking, however this is almost never the correct thing to
do as something else is very likely to go wrong (often causing
much more problems).

Protected multilib versions: libc-client-2007e-11.el6.i686 !=
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

I searched and the fix was to enable the atomic repo that was installed but disabled.

nano /etc/yum.repos.d/atomic
enabled = 1
# configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
# yum install libicu-devel
# configure: error: mcrypt.h not found. Please reinstall libmcrypt.
# yum install libmcrypt libmcrypt-devel

Then I got another:

Error: Package: (atomic)
Requires: libmcrypt =
Installed: libmcrypt-2.5.8-9.el6.x86_64 (@epel)
libmcrypt = 2.5.8-9.el6
Available: (atomic)
libmcrypt =
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

I disabled atomic repo and then got:

Error: Package: libmcrypt-devel-2.5.7-1.2.el6.rf.x86_64 (rpmforge)
Requires: libmcrypt = 2.5.7-1.2.el6.rf
Installed: libmcrypt-2.5.8-9.el6.x86_64 (@epel)
libmcrypt = 2.5.8-9.el6
Available: libmcrypt-2.5.7-1.2.el6.rf.x86_64 (rpmforge)
libmcrypt = 2.5.7-1.2.el6.rf
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

I disabled rpmforge repo enabled the epel repo.

# configure: error: Cannot find MySQL header files under /usr.
# yum install mysql-devel
# configure: error: ODBC header file '/usr/include/sqlext.h' not found!
# yum install unixODBC-devel
# configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
# yum install postgresql-devel
# configure: error: Cannot find pspell
#yum install aspell-devel
# configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
# yum install net-snmp-devel
# error: xslt-config not found
# yum install libxslt-devel

PHP error for fastcgi

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
configure: WARNING: unrecognized options: --enable-fastcgi

From –

If this is enabled, the CGI module will be built with support for FastCGI also. Available since PHP 4.3.0
As of PHP 5.3.0 this argument no longer exists and is enabled by –enable-cgi instead.

So, I changed the option:

# --enable-fastcgi


# --enable-cgi

New configure string:

 ./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' '--enable-cgi' '--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'

And, no errors

License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |

Thank you for using PHP.

Error with "make"
# make
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

You need to install the Tools needed for development using the GNU Libtool Dynamic Module Loader

yum install libtool-ltdl-devel

Then ran –

# make clean

# make

Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.

Build complete.
Don't forget to run 'make test'.

# make test

Bug #43073 (TrueType bounding box is wrong for angle<>0) freetype < 2.4.10 [ext/gd/tests/bug43073.phpt]
gmp_gcdext() basic tests [ext/gmp/tests/022.phpt]
Bug #64124 IPv6 malformed [ext/snmp/tests/bug64124.phpt]
Bug #64159: Truncated snmpget [ext/snmp/tests/bug64159.phpt]
IPv6 support [ext/snmp/tests/ipv6.phpt]
OO API: getErrno & getError methods [ext/snmp/tests/snmp-object-errno-errstr.phpt]
OO API [ext/snmp/tests/snmp-object.phpt]
Function snmp2_get [ext/snmp/tests/snmp2_get.phpt]
Function snmp2_getnext [ext/snmp/tests/snmp2_getnext.phpt]
Function snmp2_real_walk [ext/snmp/tests/snmp2_real_walk.phpt]
Function snmp2_set (without MIBs loading) [ext/snmp/tests/snmp2_set-nomib.phpt]
Function snmp2_set [ext/snmp/tests/snmp2_set.phpt]
Function snmp2_walk [ext/snmp/tests/snmp2_walk.phpt]
SNMPv3 Support (errors) [ext/snmp/tests/snmp3-error.phpt]
SNMPv3 Support [ext/snmp/tests/snmp3.phpt]
Function snmp_getvalue [ext/snmp/tests/snmp_getvalue.phpt]
Function snmpget [ext/snmp/tests/snmpget.phpt]
Function snmpgetnext [ext/snmp/tests/snmpgetnext.phpt]
Function snmprealwalk [ext/snmp/tests/snmprealwalk.phpt]
Function snmpset (without MIBs loading) [ext/snmp/tests/snmpset-nomib.phpt]
Function snmpset [ext/snmp/tests/snmpset.phpt]
Function snmpwalk [ext/snmp/tests/snmpwalk.phpt]
Bug #32001 (xml_parse*() goes into infinite loop when autodetection in effect), using UTF-* [ext/xml/tests/bug32001.phpt]

zend multibyte (2) [ext/mbstring/tests/zend_multibyte-02.phpt] (warn: XFAIL section but test passes)
zend multibyte (6) [ext/mbstring/tests/zend_multibyte-06.phpt] (warn: XFAIL section but test passes)

You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at and
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.  You can then email it to later.
Do you want to send this report now? [Yns]:

# make install

[root@austin php-5.4.31]# make install
Installing PHP CLI binary:        /usr/local/php540-cgi/bin/
Installing PHP CLI man page:      /usr/local/php540-cgi/php/man/man1/
Installing PHP CGI binary:        /usr/local/php540-cgi/bin/
Installing PHP CGI man page:      /usr/local/php540-cgi/php/man/man1/
Installing build environment:     /usr/local/php540-cgi/lib/php/build/
Installing header files:          /usr/local/php540-cgi/include/php/
Installing helper programs:       /usr/local/php540-cgi/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php540-cgi/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php540-cgi/pear/
[PEAR] Archive_Tar    - installed: 1.3.11
[PEAR] Console_Getopt - installed: 1.3.1
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.3
[PEAR] PEAR           - installed: 1.9.5
Wrote PEAR system config file at: /usr/local/php540-cgi/etc/pear.conf
You may want to add: /usr/local/php540-cgi/pear to your php.ini include_path
/usr/local/src/php540/php-5.4.31/build/shtool install -c ext/phar/phar.phar /usr/local/php540-cgi/bin
ln -s -f /usr/local/php540-cgi/bin/phar.phar /usr/local/php540-cgi/bin/phar
Installing PDO headers:          /usr/local/php540-cgi/include/php/ext/pdo/

# cp php.ini-development /usr/local/php540-cgi/etc/php.ini
# /usr/local/psa/bin/php_handler --add -displayname 5.4.31-custom -path /usr/local/php540-cgi/bin/ -phpini /usr/local/php540-cgi/etc/php.ini -type fastcgi -id php-5.4.31
ini -type fastcgi -id php-5.4.31
[2014-08-15 21:38:16] ERR [util_exec] proc_close() failed
Unable to register the PHP handler: can not get version from /usr/local/php540-cgi/bin/

Changed the path to – /usr/local/php540-cgi/bin/php-cgi

/usr/local/psa/bin/php_handler --add -displayname 5.4.31-custom -path /usr/local/php540-cgi/bin/php-cgi -phpini /usr/local/php540-cgi/etc/php.ini -type fastcgi -id 5.4.31-custom
The new PHP handler with the id "5.4.31-custom" was successfully registered.

The – login to plesk and thenew php is regsitered and can be selected.


There is also a great article for Plesk and the REMI Repo install.