How To Install MultiPHP-FPM (PHP 7.4, PHP 8.0, & PHP 8.1) on Debian 11 “bullseye”

DigitalOcean Referral Badge
Start your VPS now with FREE $100 credit.

Running MultiPHP version on single node server will give you more benefits rather than running single PHP version on the same machine. Currently supported version of PHP is starting from PHP 7.3, PHP 8.0, and PHP 8.1, it’s stable version of Hypertext Preprocessor with 2 years full active support and 1 year maintenance or security support.

Well, today I will guide you on how to install Multi PHP-FPM (PHP FastCGI Process Manager) with multiple different PHP version on Debian 11 (bullseye). We can use the software repository from DEB.SURY.ORG and install it into our cloud machine inside Alibaba Elastic Cloud Compute (ECS).

Let’s follow this tutorial to install MultiPHP-FPM on your cloud server.

PREREQUITES:

* VPS / Cloud Server / Bare-Metal
* Superuser Privileges (Root Access)
* Running with Distro Debian 11 (bullseye)
* Sever IPv4 Address
* Gnome Terminal for Linux Desktop
* PuTTY SSH Client for Windows / Mac

1.) If you run on the newly deployed cloud server, don’t forget to run system update. So your system will get the latest software update from the official software repository.

$ apt update && apt upgrade

2.) Install some software dependency

After that you need to install the following software dependencies into your system, and don’t forget to add these keys.

$ apt -y install lsb-release apt-transport-https ca-certificates
$ wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

3.) Then kindly add package repositories for PHP 7.4, PHP 8.0 and PHP 8.1

READ:  phpMyAdmin Cannot Log in to the MySQL Server - MariaDB 10.6.7 on HestiaCP Debian 11 "bullseye"

Next, simply add software repositories for PHP 7.4, PHP 8.0 and PHP 8.1 into your system.

$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php7.4.list
$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php8.0.list
$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php8.1.list

4.) Then run system update

Next step don’t forget to run the system update to get the latest available packages from the DEB.SURY.ORG PHP repositories.

$ apt update

5.) Let’s install PHP 7.4, PHP 8.0 and PHP 8.1 with FastCGI Proccess Manager, along with all the following PHP extensions.

$ apt install php7.4 php-apcu php7.4-common php7.4-mysql php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-cgi php7.4-json php7.4-cli php7.4-fpm php-pear php7.4-dev php7.4-imap php7.4-mbstring php7.4-xml php7.4-tidy php7.4-sqlite3 php7.4-xsl php7.4-gmp php7.4-zip php7.4-soap php-redis memcached php-memcache

$ apt install php8.0 php-apcu php8.0-common php8.0-mysql php8.0-xmlrpc php8.0-curl php8.0-gd php8.0-cgi php8.0-cli php8.0-fpm php-pear php8.0-dev php8.0-imap php8.0-mbstring php8.0-xml php8.0-tidy php8.0-sqlite3 php8.0-xsl php8.0-gmp php8.0-zip php8.0-soap php-redis memcached php-memcache

$ apt install php8.1 php-apcu php8.1-common php8.1-mysql php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-cgi php8.1-cli php8.1-fpm php-pear php8.1-dev php8.1-imap php8.1-mbstring php8.1-xml php8.1-tidy php8.1-sqlite3 php8.1-xsl php8.1-gmp php8.1-zip php8.1-soap php-redis memcached php-memcache

6.) Enable and Start PHP 7.4, PHP 8.0 and PHP 8.1 with the following commands.

READ:  How To Install PHP 8.1-FPM on AlmaLinux 8.5

Enable the PHP-FPM Services:

$ systemctl enable php7.4-fpm.service
Synchronizing state of php7.4-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable php7.4-fpm
$ systemctl enable php8.0-fpm.service
Synchronizing state of php8.0-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable php8.0-fpm
$ systemctl enable php8.1-fpm.service
Synchronizing state of php8.1-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable php8.1-fpm

Start the PHP-FPM Services:

$ systemctl start php7.4-fpm.service
$ systemctl start php8.0-fpm.service
$ systemctl start php8.1-fpm.service

Check Status of the PHP-FPM Services:

$ systemctl status php7.4-fpm.service
$ systemctl status php8.0-fpm.service
$ systemctl status php8.1-fpm.service
● php8.1-fpm.service – The PHP 8.1 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-03-18 18:22:01 CST; 18h ago
Docs: man:php-fpm8.1(8)
Main PID: 104721 (php-fpm8.1)
Status: “Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec”
Tasks: 3 (limit: 1059)
Memory: 12.9M
CPU: 1.952s
CGroup: /system.slice/php8.1-fpm.service
├─104721 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)
├─104722 php-fpm: pool www
└─104723 php-fpm: pool www

Mar 18 18:22:01 iZ6we9s0vpre0oqr9x39ieZ systemd[1]: Stopped The PHP 8.1 FastCGI Process Manager.
Mar 18 18:22:01 iZ6we9s0vpre0oqr9x39ieZ systemd[1]: Starting The PHP 8.1 FastCGI Process Manager…
Mar 18 18:22:01 iZ6we9s0vpre0oqr9x39ieZ systemd[1]: Started The PHP 8.1 FastCGI Process Manager.

7.) Check Versions of All Installed PHP on your machine

$ php7.4 -v
PHP 7.3.17-1+0'20200419.57+debian9'1.gpb0fda17 (cli) (build: Apr 19 2020 08:42:40) ( NTS )
Zend Engine v3.3.17, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.17-1+0~20200419.57+debian9~1.gbp0fda17, Copyright (c) 1999-2018, by Zend Technologies

$ php8.0 -v
PHP 8.0.16 (cli) (built: Feb 21 2022 14:48:35) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.16, Copyright (c) Zend Technologies
with Zend OPcache v8.0.16, Copyright (c), by Zend Technologies

$ php8.1 -v
PHP 8.1.3 (cli) (built: Feb 23 2022 16:07:16) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.3, Copyright (c) Zend Technologies
with Zend OPcache v8.1.3, Copyright (c), by Zend Technologies

CONCLUSIONS:

READ:  How To Install phpMyAdmin with Nginx on Debian 11 (bullseye)

You’ve successfully deployed MultiPHP version with FastCGI Proccess Manager under Alibaba Elastic Compute Service (ECS) with distro flavours Debian 11 (bullseye). After this step you can move on with installing and configuring Apache or Nginx web server and MySQL/MariaDB database server in order to hosted website on your machine.

Leave a Comment