- Plesk 12.5 for Linux
- Plesk Onyx for Linux
- Plesk 11.x for Linux
- Plesk 12.0 for Windows
- Plesk 12.0 for Linux
- Plesk 12.5 for Windows
Why do I need to run multiple PHP versions on the same server?
There are several reasons why you might need to run multiple versions of PHP on the same server. Maybe you have a PHP 5.2 application running on your server and you need to start working on another application based on a new framework such as Symfony2 or Lithium? Perhaps you have a client with a legacy site that runs PHP 5.2, or maybe you simply want to test some of the new functionality? Or maybe you want to move your hosting to a modern operating system, but keep some of your sites on an old PHP version that is available in your current operating system?
How can I use multiple PHP versions in Plesk 12.0 and in Plesk 12.5?
Now, with Plesk 12.0 and Plesk 12.5, you can install and use multiple PHP 5.x versions built by the Plesk team via Plesk panel, without any additional third-party repositories or building PHP from sources by yourself!
Plesk PHP packages do not conflict with or replace other PHP packages, so you can continue using your current PHP builds or third-party PHP packages.
PHP packages from the Plesk team are available on:
Plesk 12: CentOS 6, CentOS 7, and Ubuntu 14
Plesk 12.5: Ubuntu 12/14, Debian 7/8 and CentOS/RHEL 6, 7 operating systems.
Step 1. Install the necessary PHP versions packaged by the Plesk team
Install via GUI:
Go to Tools & Settings > Updates & Upgrades and choose the PHP versions you need ( Add/Remove Components > Web hosting features > Different PHP interpreters versions ).
Install via CLI:
# plesk sbin autoinstaller --select-product-id plesk --select-release-current --install-component php5.6
Note: The PHP 5 support (from OS vendor) component cannot be removed even if it is no longer needed.
Note: The PHP-FPM handler is not a part of Plesk PHP packages at the moment. This will change starting from Plesk 12.5, so you will be able to select the necessary PHP-FPM versions as well.
Step 2. Select the required PHP versions in your service plans and website settings.
After installation, new PHP versions will be available for selection in service plans and website hosting settings.
Switching Websites to PHP packaged by the Plesk Team
PHP packages from the Plesk team do not replace already installed PHP versions and do not update any existing service plans and websites. If you already use PHP packages from third-party repositories and want to move your sites to PHP packaged by the Plesk team, you need to do it manually in Plesk UI or via the Plesk command-line interface.
An easy way to do it is as follows. For example, let’s switch all websites from "PHP 5.3 fastcgi" from the CentOS 6 repository to "PHP 5.4 fastcgi" packaged by the Plesk team.
- Check that both new and old PHP handlers are registered in Plesk by executing the command
# /usr/local/psa/bin/php_handler --list
See the entries in the
- Switch all websites to the new PHP handler (as indicated by entries in the "id" column):
# /usr/local/psa/bin/php_handler --replace -old-id fastcgi -new-id plesk-php54-fastcgi
If anything goes wrong with the switch, use the attached helper utility to check the current state and to switch handlers. You need to run it as the user
The following command shows all domains and handlers currently used:
# php php_management_tool list
The next command switches all domains that use a specified PHP handler from one handler (specified with the
option) to another (specified with the
# php php_management_tool move --from=fastcgi-54 --to=plesk-php54-fastcgi
The command below switches the specified domains to the PHP handler that is specified with the --to option:
# php php_management_tool move --to=plesk-php56-cgi --domains=ex.example.com,example.com
PHP packages from the Plesk team do not conflict with packages from other third-party repositories. The package names have the "plesk-php" prefix. You can use one of the following commands to check PHP packages from the Plesk team that are currently installed on the server.
On RedHat-based operating systems:
# rpm -qa|grep "plesk-php"
# dpkg -l|grep "plesk-php"
All files are installed into
file is located in
To check the PHP handlers currently registered in Plesk, you can use this command:
# /usr/local/psa/bin/php_handler --list
How to install "
For example, if you want to install "
" packages for Plesk PHP, you need to install the plesk-phpXX-devel package for the corresponded PHP version using a system package manager tool (yum or apt):
# yum install plesk-php56-devel
# apt-get install plesk-php56-dev
Adding custom PHP modules in Plesk
To add a module, you first need to download and install the necessary packages, then build the module, and finally enable it for the corresponding PHP version. The steps for the build procedure deviate very little from the standard PHP instructions found here – just pay attention to the custom paths you will need to use.
The example below illustrates the concept by adding the memcached module for PHP 5.6. The commands in the example are for CentOS 7, but you can make use of this functionality on different OSes as well. You may need to alter the package names slightly, but the underlying principle remains the same.
Download and install the necessary packages:
# yum search plesk-php devel
# yum install make plesk-php56-devel gcc glibc-devel libmemcached-devel zlib-devel
Then build the module:
# /opt/plesk/php/5.6/bin/pecl install memcached
(when prompted for the libmemcached directory, leave it blank and press the Enter key)
Register it for the corresponding PHP version:
# echo "extension=memcached.so" > /opt/plesk/php/5.6/etc/php.d/memcached.ini
And finally, check that the module is enabled:
# /opt/plesk/php/5.6/bin/php -i | grep "memcached support"
memcached support => enabled
Possible Issues and Limitations
Plesk Mirror Tool. If you are using a Plesk repository mirror, you should update the tool by obtaining it from http://kb.plesk.com/en/113337. The current version is 1.4.
PHP-FPM and PHP Apache module are not included in PHP packages from the Plesk team.
PHP packages from the Plesk team are not available on old operating systems. Currently, PHP packages from the Plesk team are available on CentOS 6, CentOS 7, and Ubuntu-14. Starting from Plesk 12.1, we will extend this list with Ubuntu 12 and Debian operating systems.
Please post your feedback regarding the Multiple PHP feature at this Plesk forum thread
php_management_tool – utility to manage php handlers from CLI per domain for Plesk 12.0 and Plesk 12.5.
php_management_tool – utility to manage php handlers from CLI per domain for Plesk Onyx 17.0, Plesk Onyx 17.5 and Plesk Onyx 17.8.
Plesk Mirror Tool – utility to manage Plesk repository mirror.