Install Multiple PHP Versions (5.6–8.4) in ISPConfig 3.2 with PHP-FPM & FastCGI



Running multiple PHP versions on a hosting server is essential when you manage different websites with different application requirements. Some legacy applications still need PHP 5.6 or PHP 7.0, while modern websites require PHP 8.x for better performance and security.

In this complete guide, you will learn how to install and configure multiple PHP versions (PHP 5.6 to PHP 8.4) in ISPConfig 3.2 using PHP-FPM and FastCGI. This tutorial is written in very simple language so that even beginners can follow it easily.



Why Use Multiple PHP Versions in ISPConfig?

ISPConfig allows you to run different PHP versions for different websites. This is extremely useful in shared hosting and ISP environments where clients use various CMS platforms like WordPress, Laravel, or custom PHP applications.

  • Run old and new websites on the same server
  • Improve security by isolating PHP processes
  • Better performance using PHP-FPM
  • Easy PHP version switching per website


Prerequisites

Before starting, make sure your server meets the following requirements:


  • ISPConfig 3.2 installed and working
  • Ubuntu 20.04 / 22.04 (recommended)
  • Root or sudo access
  • Basic Linux command knowledge


Step 1: Update System Packages

Always update your system before installing new packages to avoid dependency issues. This ensures your server has the latest security patches.

apt update && apt upgrade -y


Step 2: Add Ondřej Surý PHP Repository

Ubuntu default repositories do not provide all PHP versions. The Ondřej Surý repository is trusted and widely used for installing multiple PHP versions.

apt install -y software-properties-common ca-certificates lsb-release apt-transport-https
add-apt-repository ppa:ondrej/php -y
apt update


Step 3: Install PHP 5.6

PHP 5.6 is considered legacy but still required for some old applications. Install PHP 5.6 with PHP-FPM and common extensions.

apt install -y php5.6 php5.6-fpm php5.6-cli php5.6-mysql php5.6-curl php5.6-gd php5.6-mbstring php5.6-xml php5.6-zip


Step 4: Install PHP 7.x Versions

PHP 7.x versions are still widely used and supported by many applications. You can install multiple versions side-by-side.

apt install -y php7.4 php7.4-fpm php7.4-cli php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-zip

Step 5: Install PHP 8.x Versions

PHP 8.x offers significant performance improvements and better security. It is recommended for modern websites.


apt install -y php8.1 php8.1-fpm php8.1-cli php8.1-mysql php8.1-curl php8.1-gd php8.1-mbstring php8.1-xml php8.1-zip


Repeat the same command structure if you want PHP 8.2, 8.3, or 8.4.



Step 6: Verify Installed PHP Versions

Check if all PHP versions are installed correctly.

update-alternatives --list php

This command shows all installed PHP CLI versions on your system.

Step 7: Enable PHP-FPM Services

Each PHP version has its own PHP-FPM service. Make sure they are running and enabled at boot.

systemctl enable php5.6-fpm php7.4-fpm php8.1-fpm
systemctl start php5.6-fpm php7.4-fpm php8.1-fpm


Step 8: Configure ISPConfig to Detect PHP Versions

Now login to ISPConfig Admin Panel. Navigate to:


System → Additional PHP Versions



Add each PHP version with the correct paths. Example for PHP 7.4:

PHP Name: PHP 7.4
PHP-FPM Init Script: php7.4-fpm
PHP-FPM Pool Dir: /etc/php/7.4/fpm/pool.d
PHP-FPM Socket Dir: /run/php

Repeat this step for all PHP versions.



Step 9: Select PHP Version Per Website

Go to:

Sites → Website → PHP Settings



Choose the required PHP version from the dropdown. This allows each website to run on its own PHP version.


FastCGI vs PHP-FPM (Which is Better?)

PHP-FPM is recommended for most setups because it offers better performance, process isolation, and security. FastCGI is still supported but mostly used for legacy compatibility.



Common Troubleshooting Tips

  • Restart PHP-FPM if a site shows 502 error
  • Check PHP-FPM socket permissions
  • Verify correct PHP path in ISPConfig
  • Check logs: /var/log/php*-fpm.log


Conclusion

By following this guide, you can successfully install and manage multiple PHP versions from PHP 5.6 to PHP 8.4 in ISPConfig 3.2 using PHP-FPM and FastCGI. This setup gives you flexibility, performance, and compatibility for all types of websites. If you manage hosting servers or ISP infrastructure, this configuration is highly recommended for long-term stability and client satisfaction.


Post a Comment

Previous Post Next Post

Contact Form