Adding Custom PHP Versions (Linux)

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

To add the support for an arbitrary PHP version in Plesk:

  1. Install the desired PHP version on your server. 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.

    Warning: These steps are provided for demonstration purposes only. Depending on your operating system and the desired configuration, installation steps can differ significantly. When you install an additional PHP version on your server, read the official PHP documentation on installation.

    1. Log in to your server as root.
    2. Obtain the PHP source you need from the official website (http://php.net/downloads.php) and unpack it:

      gunzip php-NN.tar.gz

      tar -xf php-NN.tar

    3. Configure and build PHP. This is when you can customize PHP with various options, such as specifying which extensions will be enabled. Run ./configure --help for a list of available options.

      cd ../php-NN

      ./configure --prefix /usr/local/phpNN

      make

      make install

    4. Set up your php.ini:

      cp php.ini-development /usr/local/lib/php.ini

      You may edit your .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 3.

  2. Register the new PHP version in Plesk:

    /usr/local/psa/bin/php_handler --add -displayname <NN> -path <path to php cgi> -phpini <path to php.ini> -type <php handler> -id <NN-custom>

    where

    • -displayname <NN> is the PHP version name that will be shown in the Plesk UI. We recommend that you include the version number in the displayname, for example, you can name the version "5.3.3-custom".
    • -path <path to php cgi>i 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 http://php.net/manual/en/install.unix.commandline.php.
    • -phpini <path to php.ini> is the location of the php.ini file, for example, /some/path/php.ini .
    • -type <php handler> 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.

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

After you register the PHP version in Plesk, it will be available for selection in service plan settings (Service Plans > plan name > PHP Settings) and in the PHP settings individual websites (Websites & Domains > PHP Settings). See the picture below.

PHP_versions

 

Leave your comments on this page

Leave your feedback or question on this documentation topic below. For technical assistance, contact your hosting service provider or submit a request to Plesk support. Suggest new features for Plesk here. Discuss general questions on the Plesk forum. All offtopic comments will be removed.