Article ID: 114753, created on Sep 12, 2012, last review on Jun 17, 2016

  • Applies to:
  • Plesk 11.0 for Linux

Fixed Since

Plesk for Linux has supported running multiple versions of PHP on the server since version 11.5 (see the release notes). Instructions on installing and configuring PHP on Plesk 11.5 servers are available in the Plesk Administrator's Guide

Note: For Plesk 11.5, 12.0 use this article: #118378 How to enable multiple PHP versions in Plesk for Linux


NOTE: The instructions below are for Plesk 11.0.9 only. For Plesk 11.5, use the documentation mentioned above.

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

  1. SSH to your Plesk 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 MUST use the prefix switch 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-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'

    As you can see, this is the prefix: /usr/local/php540-cgi/

    Choosing a prefix is ESSENTIAL because it prevents your new PHP installation from interfering with the older PHP version used by Plesk.

  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 newer PHP functions that do not exist in the default PHP 5.1. We will tell Apache to use our new PHP version (5.4.0):

    # cd /var/www/vhosts/
    # mkdir .cgi_wrapper
    # cd .cgi_wrapper

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

    export PHPRC=/var/www/vhosts/
    export PHP_FCGI_CHILDREN=4
    export PHP_FCGI_MAX_REQUESTS=1000
    exec /usr/local/php540-cgi/bin/php-cgi

    Set the necessary permissions and privileges for the files and directories you created:

    # 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. Plesk offers an option to change the httpd setup per vhost (it could be either a domain or subdomain). We will use this option to tell Apache that, as per our example, needs to use our new PHP wrapper instead of the one provided by Plesk:

    # cd /var/www/vhosts/

    Create a vhost.conf file 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 Plesk 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 version 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 that are only available in newer PHP versions, perform Steps 4, 5, 6, and 7 (replacing "" with your customer's domain name).

Search Words


The app requires PHP 5.3.10 or later. Your PHP is 5.3.3.

enable php-cgi

Cannot upgrade PHP

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

multiple PHP versions

56797cefb1efc9130f7c48a7d1db0f0c a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838 aea4cd7bfd353ad7a1341a257ad4724a 0a53c5a9ca65a74d37ef5c5eaeb55d7f

Email subscription for changes to this article
Save as PDF