PHP 5.6 is an outdated release of PHP that reached end-of-life (EOL) on December 31, 2018. It no longer receives security patches and is therefore vulnerable to exploits. Still, certain legacy applications may depend on PHP 5.6 for compatibility.
Warning
Never use PHP 5.6 in production. It presents serious security vulnerabilities and should only be deployed in development or testing environments.
Matching infrastructure at centron
No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →
Prerequisites
Before you begin:
- Ensure you have access to a Debian 12 Linux instance with a non-root user who has sudo privileges.
Add the PHP PPA Repository
Debian 12 does not ship with PHP 5.6 in its default repositories. You must add a third-party repository. Follow these steps to include the SURY PHP PPA repository.
Update the package index
$ sudo apt update -yUpgrade all existing packages
$ sudo apt upgrade -yInstall required dependencies for HTTPS transport and certificate management
$ sudo apt install -y software-properties-common ca-certificates lsb-release apt-transport-httpsDownload the SURY GPG key
$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpgAdd the SURY PPA repository information to your APT sources
$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.listUpdate the package index again to apply repository changes
$ sudo apt update -yVerify the added PPA
$ sudo apt policy phpExample output:
php:
Installed: (none)
Candidate: 2:8.4+96+0~20250402.56+debian12~1.gbp84a5b7
...
Install PHP 5.6
Proceed with the following steps to install PHP 5.6 on your Debian 12 system.
Install PHP 5.6
$ sudo apt install php5.6 -yVerify the PHP version
$ php5.6 -vExample output:
PHP 5.6.40-81+0~20250311.98+debian12~1.gbp4564f4 (cli)
...
Install common PHP 5.6 extensions
$ sudo apt install -y php5.6-common php5.6-mysql php5.6-xml php5.6-json php5.6-curl php5.6-gd php5.6-mbstring php5.6-zipInstall PHP 5.6 FPM
PHP-FPM (FastCGI Process Manager) enables PHP to work efficiently with web servers to handle dynamic content. Follow these steps to install PHP-FPM for PHP 5.6.
Install PHP 5.6 FPM
$ sudo apt install -y php5.6-fpmEnable PHP-FPM service at boot
$ sudo systemctl enable php5.6-fpmStart the PHP-FPM service
$ sudo systemctl start php5.6-fpmCheck PHP-FPM status
$ sudo systemctl status php5.6-fpmExample output:
● php5.6-fpm.service - The PHP 5.6 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php5.6-fpm.service; enabled; preset: enabled)
Active: active (running) since Sat 2025-04-12 03:58:28 UTC; 11s ago
...
Test and Use PHP 5.6
Before proceeding, confirm that PHP 5.6 is working correctly and that the required extensions are active.
Create an info.php file for testing
$ sudo nano /var/www/html/info.phpAdd the following content to the file
<!--?php phpinfo(); ?-->The phpinfo() function displays details about your PHP setup and other system information.
Save and close the file.
Enable the PHP-FPM configuration for Apache
$ sudo a2enconf php5.6-fpmReload Apache to apply the new configuration
$ sudo systemctl reload apache2Allow HTTP traffic through the firewall
$ sudo ufw allow httpReload UFW to apply the changes
$ sudo ufw reloadNow open the info.php file in your web browser and confirm that PHP information is displayed.
Example: http://app.example.com/info.php
Conclusion
You have successfully installed PHP 5.6 and PHP-FPM 5.6 on Debian 12. Your system can now process and serve PHP files. Remember that this PHP version is outdated and insecure. Use it only for legacy application testing, and for production environments upgrade to a supported PHP release such as PHP 8.3.
Testen Sie Ihr Setup auf ccloud³
Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.