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 to operate. 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 to put together, or if you just want to try, you can also download the virtual machines. In this description, I will use the bold highlighted version of Debian 10, and I recommend this as well, as this is currently the latest server version on the site. 

Here's a guide to setting up virtual machines: How to configure VirtualBox for basic systems (Although a new one has come out since the writing of the description VirtualBox version, the setting process is still the same).

Installed PHP instances

Another condition is that there are several different versions of PHP systems available on the server. In this description, we will not cover individual PHP installations, but will focus only on configuring ISPConfig. However, in the past we have already prepared a point-by-step guide, of which we only need to perform the first page, and from here we only need to install the PHP versions we need: 

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, check which PHP versions are available. You can skip this step, but it's a good idea to check if, for example, PHP versions have been installed before, 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 mandatory to install and configure all of them, but which one you want to use.

Create a new PHP version in ISPConfig

When ISPConfig is available on our server, enter the interface as Admin (I left the interface language in the original setting, 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 setting (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/ will look for the init script in the directory, so you only need to enter the filename itself. For the other two options, you must specify the php.ini and PHP-FPM pool directories with absolute paths. They do not need a / sign at the end.

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

 

Configuring PHP 8.0

Update 2021-02-06:
PHP 8 installation and configuration description completed: 

 

 

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.