Article ID: 114753, created on Apr 1, 2013, last review on May 5, 2014

  • Applies to:
  • Plesk 11.0 for Linux


For this to work, you must have PHP running as fastcgi.

1. SSH to your Parallels Plesk Panel (PP) server 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

Note: You HAVE TO USE THE PREFIX SWITCH in order for your new PHP to be installed inside a single directory. For example:
# ./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'

As you can see, this is the prefix: /usr/local/php540-cgi/
Choosing a prefix is a MUST because it prevents your new PHP installation from interfering with the older PHP version used by PP.

2. Compile your PHP:
# make

3. Install your new PHP:
# make install

4. Create a PHP wrapper. For example, let's say you have a customer,, that uses some newer PHP functions that don't exist in the default PHP 5.1. Let's call that customer We will tell Apache to use our new PHP version (5.4.0) for him:
# cd /var/www/vhosts/
# mkdir .cgi_wrapper
# cd .cgi_wrapper

Create a new file, .phpwrapper, with the following content:

export PHPRC=/var/www/vhosts/
exec /usr/local/php540-cgi/bin/php-cgi

Set necessary permissions and privileges for created files and directories:
# chgrp psaserv /var/www/vhosts/
# cd /var/www/vhosts/
# chmod 101 .cgi_wrapper
# chmod 500 .cgi_wrapper/.phpwrapper
# chown .cgi_wrapper -R
# chattr -R +i .cgi_wrapper

5. Make Apache aware of our new PHP wrapper. PP offers an option to change the httpd setup per host. We will use this option to tell Apache needs to use our new PHP wrapper instead of the one provided by PP:
# cd /var/www/vhosts/

Create a vhost.conf file there with the following content:

<Directory /var/www/vhosts/>
RemoveHandler fcgid-script
<IfModule mod_fcgid.c>
    AddHandler fcgid-script .php
    <Files ~ (\.php)>
        SetHandler fcgid-script
        FCGIWrapper /var/www/vhosts/ .php
        Options +ExecCGI
        allow from all

So far, we have told Apache not to use the default PP PHP wrapper (RemoveHandler fcgid-script) and instead, we created a new handler for PHP files. When executing PHP files on the domain, Apache will call the new PHP wrapper and use the new PHP that was installed in Steps 1-3.

6. Reconfigure the domain:
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain

7. Restart Apache:
# /etc/init.d/httpd restart

For every domain that needs extra functions provided only in PHP versions newer than the one provided with PP, you can perform Steps 4, 5, 6, and 7 (replacing with your customer's domain name).

56797cefb1efc9130f7c48a7d1db0f0c a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838 aea4cd7bfd353ad7a1341a257ad4724a 0a53c5a9ca65a74d37ef5c5eaeb55d7f

Email subscription for changes to this article