Learn how to install unsupported versions of PHP in your plesk based Ubuntu 18.04 server.

If you hire the services of a server provider, like Server4You, you will probably be limited to specific operating systems of the servers, usually the latest release available of it. For example, if you have a brand new server and select the operative system from their catalogue to Ubuntu, you will see that they offer only the latest release till the date e.g Ubuntu 18.04.

This situation by itself is not bad, as you are using the latest version of the system, however with new things appear new limitations for multiple stuff. One of these limitations appears in Plesk, which by default using Ubuntu 18.04, won't allow to install a PHP version prior to 7.0, which is simply ridiculous for projects that cannot be rewritten to the latest version of the language and that usually should work normally.

As explained in this official question at the plesk website:

By default, Debian 9 and Ubuntu 18.04 support only those versions of PHP that support OpenSSL 1.1, and that are PHP 7.x and newer. As Debian 9 and Ubuntu 18.04 do not support such configuration out of the box, it is not possible to install PHP 5.x via Plesk Installer.

That's bad for those who are unable to work with the terminal in their servers as they will unable to install it, however if you have the ability to use the terminal, we will show you a nice fix to install PHP 5.6 in your server and configure it to work with Plesk in Ubuntu 18.04.

1. Install PHP 5.6

As first step, you will need to install PHP from the command line, this will install this version of PHP system wide, this means not exclusively for Plesk. Run the following commands to install the latest version of PHP 5.6:

sudo apt-get install software-properties-common

sudo add-apt-repository -y ppa:ondrej/php

sudo apt-get update

sudo apt-get install php5.6

They will basically: install the software-properties-common package, this software provides an abstraction of the used apt repositories. It allows you to easily manage your distribution and independent software vendor software sources. Then add the repository where PHP 5.6 is available, update the repositories and install it.

Once you run the commands, you will have a basic installation of PHP 5.6, this means that it doesn't include almost any of the extensions that we usually need to work with it, however you can easily install them (at least the usual ones) with the following command:

# Install basic extensions
sudo apt-get install php5.6-gd php5.6-mysql php5.6-dom php5.6-cli php5.6-json php5.6-common php5.6-mbstring php5.6-opcache php5.6-readline php5.6-xsl php5.6-bcmath php5.6-mbstring php5.6-soap php5.6-xml php5.6-zip

Following the previous instructions, you will have now PHP 5.6 available in your system, specifically at the /usr/bin/php5.6 path.

2. Install PHP 5.6 CGI

Plesk requires a Common Gateway Interface to work with PHP (CGI), a web technology and protocol that defines a way for a web server (HTTP server) to interact with external applications, e.g. PHP. CGI enhances the web server capabilities to enable dynamic content generation and processing. CGI is used as an interface between the web server and the additionally installed applications generating dynamic web content. These applications are called CGI scripts and are written in different script and programming languages such as PHP, Perl, Python, etc.

To install the CGI of PHP 5.6, run the following command:

# Install CGI for Fast CGI support
sudo apt-get install php5.6-cgi

By using CGI or FastCGI the server runs an executable binary that is the PHP interpreter. This is an isolated process, performed outside the web server's process. After changes in the PHP settings (in the php.ini file), a PHP process alone can be restarted without this influencing the web server. The CGI is installed tipically at /usr/bin/php-cgi5.6.

3. Register the handler of PHP 5.6 in Plesk

The command to register a new handler in Plesk with a custom version of PHP is the following one:

# Format to register new handler
/usr/local/psa/bin/php_handler --add -displayname <NN> -path <path to php cgi> -phpini <path to php.ini> -clipath <path to php binary> -type <php handler> -id <NN-custom>


  • --add: indicates that we are registering a new PHP handler.
  • -displayname: the name that will appear on the list of PHP handlers. It can be whatever you want, but a notation of PHPX.X is recommended.
  • -path: the absolute path to the PHP CGI binary.
  • -phpini: provide the absolute path to the php.ini file that will be used for the new PHP version.
  • -clipath: provide the absolute path to the binary of PHP.
  • -type: specify if the handler should handle CGI or FastCGI. For PHP 5.6, the recommended value is of FastCGI.
  • -id: In Plesk, every PHP version has an id, which is usually something like "plesk-php55-cgi". The list of php handlers can be shown with plesk bin php_handler --list.

And that's it, you should simply replace the values with your own values. With a default installation of this tutorial, the command will look like:

# Register PHP 5.6 Handler
/usr/local/psa/bin/php_handler --add 
    -displayname php5.6-os
    -path /usr/bin/php-cgi5.6
    -phpini /etc/php/5.6/apache2/php.ini
    -clipath /usr/bin/php5.6
    -type fastcgi 
    -id php5.6-so

After running the command, you should see an output similar to:

The new PHP handler with the id "php5.6-os" was successfully registered.

You can then see the new available PHP version at the PHP settings of plesk (or in the command line with plesk bin php_handler --list):

PHP Custom Version Plesk Onyx Ubuntu 18.04

Happy coding !

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.