• Article for your preferred language does not exist. Below is international version of the article.

Article ID: 123679, created on Nov 26, 2014, last review on Dec 20, 2015

  • Applies to:
  • Plesk Automation 11.5

Symptoms

On Linux systems, you can install any PHP version you need and then make it available in Plesk Automation (PA) by registering it with the php_handler command line utility.

Cause

A PHP version is required that is not provided in Plesk Automation (PA).

Resolution

  1. Install the required PHP version on your Apache service node. For installation guidelines, refer to the official PHP documentation available at http://php.net/manual/en/install.php. In brief, the installation includes the following main steps:

    Note: it is recommended that you build PHP in another (non-production) environment with the same operating system version as the target server. This will help you avoid installing unnecessary packages on your production system.
    

    a. SSH to the computer which is used for PHP compilation as root. Download the PHP source, unpack and configure it:

        # cd /usr/local/src
        # wget http://php.net/distributions/php-5.6.3.tar.bz2
        # tar xjvf php-5.6.3.tar.bz2
        # mv php-5.6.3 php563
    

    Install the necessary libraries (the library names below are given for CentOS 6.x):

        # yum install gcc-c++ libxml2-devel openssl-devel openldap-devel bzip2-devel curl-devel libjpeg-devel libpng-devel freetype-devel gmp-devel mysql-devel ncurses-devel unixODBC-devel net-snmp-devel mhash-devel libc-client-devel libicu-devel gcc postgresql-devel aspell-devel libxslt-devel
    

    Depending on your system, you may need to install some additional libraries (this will become clear on the './configure' step):

        # cd /usr/local/src/php563
        # ./configure '--with-libdir=lib64' '--cache-file=../config.cache' '--prefix=/usr/local/php563-cgi' '--with-config-file-path=/usr/local/php563-cgi/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--with-bz2' '--with-curl' '--with-freetype-dir=/usr/local/php563-cgi' '--with-png-dir=/usr/local/php563-cgi' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr/local/php563-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/php563-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/php563-cgi/pear' '--enable-intl' '--without-pdo-sqlite' '--with-config-file-scan-dir=/usr/local/php563-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/php563-cgi/

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

    b. After the configuration successfully finishes, compile PHP:

        # cd /usr/local/src/php563
        # make
    

    c. [Skip this step if you are bulding PHP on your production environment] Archive the compiled PHP and transfer it to your Apache service node. Please note that the full path to the directory containing compiled PHP on the service node must be the same as on the source server:

        # cd /usr/local/src/
        # tar cjvf php563.tar.bz2 php563
        # scp php563.tar.bz2 root@<your_apache_node_ip>:/usr/local/src
    

    SSH to the Apache service node and unpack the archive file containing the compiled PHP:

        # cd /usr/local/src
        # tar xjvf php563.tar.bz2
    

    d. Install PHP on the Apache service node:

        # cd /usr/local/src/php563
        # make install
    

    e. Set up php.ini:

        # cp php.ini-development /usr/local/php563-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 a).

  2. Register the new PHP version:

    Log into the PA Management Node and run the following command:

    # /usr/local/psa/bin/php_handler --add -displayname <NN> -path <path to php cgi on SN> -phpini <path to php.ini on SN> -type <php handler> -id <NN-custom> -service-node <ip_address>
    

    Where:

    • -displayname <NN> is the PHP version name that will be shown in the Plesk interface. We recommend you include the version number in the displayname. For example, you could name the version "5.6.3-custom".

    • -path <path to php cgi> 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/php563-cgi/bin/, the location you need to specify is /usr/local/php563-cgi/bin/php-cgi. Learn more at the Official PHP web Site.

    • -phpini <path to php.ini> is the location of the php.ini file, for example /usr/local/php563-cgi/ .

    • -type <php handler> is the type of PHP handler associated with this version. It can either be 'cgi' or 'fastcgi'.

    • -id <NN-custom> (optional) is the identifier that you will use for referring to this PHP version (for example, when adjusting or removing it).

    • -service-node <ip_address> is the private IP address used for communication between the Management Node and Apache Service Node.

    For example:

    [root@pa ~]# /usr/local/psa/bin/php_handler --add -displayname php-5.6.3 -path /usr/local/php563-cgi/bin/php-cgi -phpini /usr/local/php563-cgi/php.ini -type fastcgi -id 2 -service-node 192.168.0.1
    
  3. Access the 'Service Nodes' tab.
  4. Select the node where the package has been installed.

  5. On the 'Summary' page, click "Refresh" under the 'User-Installed Packages' section.

After you register the PHP version in Plesk or PA, it will be available for selection in service plan settings and in the hosting settings of a particular website. See the picture below:

Link to PA documentation

In addition:

To see a list of registered PHP handlers for an Apache service node with the IP 192.168.0.1, run this command on the Management Node:

[root@mnode ~]# /usr/local/psa/bin/php_handler --list -service-node 192.168.0.1

Search Words

php

multiple php in PPA

mod_deflate, compression

joomla

APC or another op-code cache

multiple php version on PPA 11.5

php versions does not seem

PHP version

Unable to register the PHP handler

install of multiple PHP versions on Apache node

multiple php

mod_deflate

php 5.3.10

Upgrading PHP / multiple PHP

adding zip extension to compiled php

PHP Upgrade

upgrade php plesk automation

php_handler

apc ppa

upgrade php

op-code cache

PHP version after installation

php version installing problem

multiple php versions for shared hosting

PHP Update

enable multiple php versions

33a70544d00d562bbc5b17762c4ed2b3 caea8340e2d186a540518d08602aa065 e0aff7830fa22f92062ee4db78133079

Email subscription for changes to this article
Save as PDF