How to configure custom PHP versions on our ISPConfig server

botond published 2020. 01. 27., H - 18: 30 time

Content

Introductory

If you have more than one web site on our server, you may need different web pages PHP version. ISPConfig using it is a very simple task as the control panel can run multiple versions of PHP at the same time. In this tutorial, we'll walk you through how to configure PHP instances installed on your server with FastCGI and PHP-FPM modes.

Prerequisites

You need certain conditions to make the settings, let's see what these are:

server Configuration

The first step is to install a server that contains the ISPConfig control panel. For example, one of the following:

So any server is good for this task, you can choose which one you want to put together, or if you want to try it, you can also download virtual machines. For the purposes of this tutorial, I will use the bold highlighted version of Debian 10, and recommend it as it is currently the latest server version on this page.

Here's a guide to setting up virtual machines: How to configure VirtualBox for basic systems (Although a new version of VirtualBox has been released since the description was written, the setup process is still the same).

Installed PHP instances

It is also a prerequisite that the server has several different versions of PHP. In this tutorial, we do not discuss custom PHP installs, but focus only on configuring ISPConfig. However, there is a point-by-step guide that we need to do just the first page and install only the PHP versions we need from here:

So once again, let's just execute the first page of the link I just linked, the rest is set up in the ISPConfig interface.

Alternatively installed PHP systems (such as manually compiled) can also be configured on the ISPConfig interface, but these will require different path settings, so the PHP installation will now be done using the link above.

Configure custom PHP versions in the ISPConfig interface

If the above conditions are met then the PHP settings in ISPConfig can come.

Check for available PHP versions

First we check which PHP versions are available. You can skip this step, but it's a good idea to check if PHP versions have already been installed, so we don't remember exactly which versions are on the server. To do this, run the following commands:

ls -al /etc/php
ls -al /run/php

The first command checks the existence of PHP installation libraries, and the second command checks the socket files of the various versions needed for PHP-FPM to work. These are output from my Debian 10 perfect server:

Check PHP versions

For the sake of today's example, I have now installed all available PHP versions, which are also listed ( phpMyAdmin socket file still in the Installing Debian 10 LAMP Server (so it is present). Of course, it is not obligatory to install and configure each one, but the one you want to use.

Create a new PHP version in ISPConfig

Log on to the interface as an Admin for the ISPConfig availability of our server (I left the interface language in its original configuration so it will appear in English):

ISPConfig Admin Login - Home Screen

Let's move to the top right System main menu, then to the left Additional PHP Versions menu:

ISPConfig - System - Other PHP versions

Click here for the green Add new PHP version button. This will bring up the new PHP form:

ISPConfig - System - Other PHP Versions - Add New

So with this option you need to create and configure all the unique PHP versions you want to use. Below, we'll review the settings for these PHP versions.

Depending on your server's distribution and version, the default PHP versions are different. However, it is also worth setting it up as a custom version in order to keep the configuration structure of our server clear.

Configuring PHP 5.6

Name tab

ISPConfig - Other PHP Versions - PHP 5.6 - Name tab

  • Server: Select the name of your server
  • Client: If you are using clients, it is advisable to leave it blank so that all clients will have access to this version of PHP.
  • PHP Name: PHP 5.6
  • Active: kite

FastCGI Settings tab

ISPConfig - Other PHP Versions - PHP 5.6 - FastCGI Settings Tab

  • Path to the PHP FastCGI binary: php cgi5.6
  • Path to the php.ini directory: /etc/php/5.6/cgi

Note here that you do not need to use an absolute path for the first value, because the php-cgi files / usr / bin are in the directory that are included in the path by default:

check php-cgi files

So you don't need a / sign at the beginning or the end.

The second option (ini directory path) is an absolute path, so it starts with /!

PHP-FPM Settings tab

ISPConfig - Other PHP Versions - PHP 5.6 - PHP-FPM Settings tab

  • Path to the PHP-FPM init script: php5.6-fpm
  • Path to the php.ini directory: / etc / php / 5.6 / fpm
  • Path to the PHP-FPM Pool directory: /etc/php/5.6/fpm/pool.d

Here, too, at the first setup, the system will automatically a /etc/init.d/ directory will look for the init script, so you just have to enter the filename itself. The other two options require absolute paths to specify the php.ini and PHP-FPM pool directories. You do not need / to end these.

Also, be careful not to leave any space before or after copying these settings from here! It can be a sneaky mistake, I've sucked for it in the past.

Finally, save the form.

Configuring PHP 7.0

Let's create a newer PHP version and set everything up the same way as the previous one. I'm not taking pictures here anymore, so beware of relative and absolute paths here too!

Name tab

  • Server: Select the name of your server
  • Client: Leave it blank
  • PHP Name: PHP 7.0
  • Active: kite

FastCGI Settings tab

  • Path to the PHP FastCGI binary: php cgi7.0
  • Path to the php.ini directory: /etc/php/7.0/cgi

PHP-FPM Settings tab

  • Path to the PHP-FPM init script: php7.0-fpm
  • Path to the php.ini directory: / etc / php / 7.0 / fpm
  • Path to the PHP-FPM Pool directory: /etc/php/7.0/fpm/pool.d

Configuring PHP 7.1

The next is the same ...

Name tab

  • Server: Select the name of your server
  • Client: Leave it blank
  • PHP Name: PHP 7.1
  • Active: kite

FastCGI Settings tab

  • Path to the PHP FastCGI binary: php cgi7.1
  • Path to the php.ini directory: /etc/php/7.1/cgi

PHP-FPM Settings tab

  • Path to the PHP-FPM init script: php7.1-fpm
  • Path to the php.ini directory: / etc / php / 7.1 / fpm
  • Path to the PHP-FPM Pool directory: /etc/php/7.1/fpm/pool.d

Configuring PHP 7.2

Name tab

  • Server: Select the name of your server
  • Client: Leave it blank
  • PHP Name: PHP 7.2
  • Active: kite

FastCGI Settings tab

  • Path to the PHP FastCGI binary: php cgi7.2
  • Path to the php.ini directory: /etc/php/7.2/cgi

PHP-FPM Settings tab

  • Path to the PHP-FPM init script: php7.2-fpm
  • Path to the php.ini directory: / etc / php / 7.2 / fpm
  • Path to the PHP-FPM Pool directory: /etc/php/7.2/fpm/pool.d

Configuring PHP 7.3

Name tab

  • Server: Select the name of your server
  • Client: Leave it blank
  • PHP Name: PHP 7.3
  • Active: kite

FastCGI Settings tab

  • Path to the PHP FastCGI binary: php cgi7.3
  • Path to the php.ini directory: /etc/php/7.3/cgi

PHP-FPM Settings tab

  • Path to the PHP-FPM init script: php7.3-fpm
  • Path to the php.ini directory: / etc / php / 7.3 / fpm
  • Path to the PHP-FPM Pool directory: /etc/php/7.3/fpm/pool.d

Configuring PHP 7.4

Name tab

  • Server: Select the name of your server
  • Client: Leave it blank
  • PHP Name: PHP 7.4
  • Active: kite

FastCGI Settings tab

  • Path to the PHP FastCGI binary: php cgi7.4
  • Path to the php.ini directory: /etc/php/7.4/cgi

PHP-FPM Settings tab

  • Path to the PHP-FPM init script: php7.4-fpm
  • Path to the php.ini directory: / etc / php / 7.4 / fpm
  • Path to the PHP-FPM Pool directory: /etc/php/7.4/fpm/pool.d

Once we have all set, our list will look like this:

ISPConfig - Configured PHP versions

Conclusion

So that would be setting up custom PHP versions in ISPConfig. After that, you can configure the web pages in the appropriate PHP version of the page. These PHP variants can be used in FastCGI and PHP-FPM modes, of which I recommend using more modern PHP-FPM.