PHP 5.6 on Debian 12 (How to)

wattie

Verified User
Joined
May 31, 2008
Messages
1,211
Location
Bulgaria
I wish to share my experience with running PHP 5.6 on Debian 12. As you all probably know, Debian 12 is comming with OpenSSL 3 and PHP 5.6 is not going to run with it. Therefore you need to run two Open SSL installations. Here is how to do it:

1. Download openssl 1.1.1 tar.gz from the official website (https://www.openssl.org/source/openssl-1.1.1u.tar.gz). Untar and ungz it. Then do configure it the following way:
Code:
./config --prefix=/openssl-1.1.1 --openssldir=/openssl-1.1.1
make
make install

This will install it in /openssl-1.1.1 directory.

2. Download the Libssl 1.1 package. It is no longer available in the Debian repository, so you can't install it with apt. You need to manually download it. Here is the link: http://ftp.de.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1n-0+deb11u4_amd64.deb

Then install it the following way:

Code:
dpkg -i libssl1.1_1.1.1n-0+deb11u4_amd64.deb

3. Test if Openssl 1.1.1 works. Go to the bin folder and test it out.

4. Install PHP 5.6:

Code:
cd /usr/local/directadmin/custombuild
mkdir custom
cd custom
mkdir php
mkdir fpm
touch /usr/local/directadmin/custombuild/custom/fpm/custom_openssl
cd ../../
cp -p configure/php/configure.php56 custom/php/configure.php56

5. Now edit the custom config file:

Code:
vi custom/php/configure.php56
\

and add

Code:
--openssldir=/openssl-1.1.1

remove this (it will not compile icu and intl):

Code:
--with-icu-dir=/usr/local/icu \
--enable_intl

They are the last two lines - it won't compile with them.

Ready. Build php 5.6 and it will work.
 
Last edited:
I wish to share my experience with running PHP 5.6 on Debian 12. As you all probably know, Debian 12 is comming with OpenSSL 3 and PHP 5.6 is not going to run with it. Therefore you need to run two Open SSL installations. Here is how to do it:

1. Download openssl 1.1.1 tar.gz from the official website (https://www.openssl.org/source/openssl-1.1.1u.tar.gz). Untar and ungz it. Then do configure it the following way:
Code:
./config --prefix=/openssl-1.1.1 --openssldir=/openssl-1.1.1
make
make install

This will install it in /openssl-1.1.1 directory.

2. Download the Libssl 1.1 package. It is no longer available in the Debian repository, so you can't install it with apt. You need to manually download it. Here is the link: http://ftp.de.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1n-0+deb11u4_amd64.deb

Then install it the following way:

Code:
dpkg -i libssl1.1_1.1.1n-0+deb11u4_amd64.deb

3. Test if Openssl 1.1.1 works. Go to the bin folder and test it out.

4. Install PHP 5.6:

Code:
cd /usr/local/directadmin/custombuild
mkdir custom
cd custom
mkdir php
mkdir fpm
touch /usr/local/directadmin/custombuild/custom/fpm/custom_openssl
cd ../../
cp -p configure/php/configure.php56 custom/php/configure.php56

5. Now edit the custom config file:

Code:
vi custom/php/configure.php56
\

and add

Code:
--openssldir=/openssl-1.1.1

remove this (it will not compile icu and intl):

Code:
--with-icu-dir=/usr/local/icu \
--enable_intl

They are the last two lines - it won't compile with them.

Ready. Build php 5.6 and it will work.

Sorry bring old thread back.
Will it work for php 7.4 also?

By default cant install php lower than 8.1 on Debian 12 :(
 
Sorry bring old thread back.
Will it work for php 7.4 also?

By default cant install php lower than 8.1 on Debian 12 :(

Yes.

Bash:
## Compile OpenSSL 1.1.1
wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar xvf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w
./config --prefix=/opt/openssl-1.1.1w --openssldir=/opt/openssl-1.1.1w no-ssl2 no-ssl3 -fPIC
make && make install

## Install libssl
wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0~deb11u1_amd64.deb
dpkg -i libssl1.1_1.1.1w-0~deb11u1_amd64.deb

## Prepare DA/CB
cd /usr/local/directadmin/custombuild
mkdir -p custom/php custom/fpm
touch custom/fpm/.custom_openssl
touch custom/php/configure.php74

Modify options.conf and set:
Code:
phpX_release=7.4
phpX_mode=php-fpm

Contents of custom/php/configure.php74 are:
Bash:
#!/bin/sh
export OPENSSL_CFLAGS="-I/opt/openssl-1.1.1w/include"
export OPENSSL_LIBS="-L/opt/openssl-1.1.1w/lib -lssl -lcrypto -lz"
export PKG_CONFIG_PATH="/opt/openssl-1.1.1w/lib/pkgconfig"
export LD_PRELOAD="/lib/x86_64-linux-gnu/libssl.so.1.1"

./configure --enable-embed \
        --prefix=/usr/local/php74 \
        --program-suffix=74 \
        --enable-fpm \
        --with-fpm-systemd \
        --enable-litespeed \
        --with-config-file-scan-dir=/usr/local/php74/lib/php.conf.d \
        --with-curl \
        --enable-gd \
        --with-gettext \
        --with-jpeg \
        --with-freetype \
        --with-kerberos \
        --with-openssl=/opt/openssl-1.1.1w \
        --with-mhash \
        --with-mysql-sock=/var/lib/mysql/mysql.sock \
        --with-mysqli=mysqlnd \
        --with-pdo-mysql=mysqlnd \
        --with-pear \
        --with-sodium=/usr/local \
        --with-webp \
        --with-xsl \
        --with-zlib \
        --with-zip \
        --with-iconv-dir=/usr \
        --enable-bcmath \
        --enable-calendar \
        --enable-exif \
        --enable-ftp \
        --enable-sockets \
        --enable-soap \
        --enable-mbstring \
        --enable-intl

Cross your fingers and run:
Bash:
./build php_expert 7.4 php-fpm
 
Yes.

Bash:
## Compile OpenSSL 1.1.1
wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar xvf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w
./config --prefix=/opt/openssl-1.1.1w --openssldir=/opt/openssl-1.1.1w no-ssl2 no-ssl3 -fPIC
make && make install

## Install libssl
wget http://ftp.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0~deb11u1_amd64.deb
dpkg -i libssl1.1_1.1.1w-0~deb11u1_amd64.deb

## Prepare DA/CB
cd /usr/local/directadmin/custombuild
mkdir -p custom/php custom/fpm
touch custom/fpm/.custom_openssl
touch custom/php/configure.php74

Modify options.conf and set:
Code:
phpX_release=7.4
phpX_mode=php-fpm

Contents of custom/php/configure.php74 are:
Bash:
#!/bin/sh
export OPENSSL_CFLAGS="-I/opt/openssl-1.1.1w/include"
export OPENSSL_LIBS="-L/opt/openssl-1.1.1w/lib -lssl -lcrypto -lz"
export PKG_CONFIG_PATH="/opt/openssl-1.1.1w/lib/pkgconfig"
export LD_PRELOAD="/lib/x86_64-linux-gnu/libssl.so.1.1"

./configure --enable-embed \
        --prefix=/usr/local/php74 \
        --program-suffix=74 \
        --enable-fpm \
        --with-fpm-systemd \
        --enable-litespeed \
        --with-config-file-scan-dir=/usr/local/php74/lib/php.conf.d \
        --with-curl \
        --enable-gd \
        --with-gettext \
        --with-jpeg \
        --with-freetype \
        --with-kerberos \
        --with-openssl=/opt/openssl-1.1.1w \
        --with-mhash \
        --with-mysql-sock=/var/lib/mysql/mysql.sock \
        --with-mysqli=mysqlnd \
        --with-pdo-mysql=mysqlnd \
        --with-pear \
        --with-sodium=/usr/local \
        --with-webp \
        --with-xsl \
        --with-zlib \
        --with-zip \
        --with-iconv-dir=/usr \
        --enable-bcmath \
        --enable-calendar \
        --enable-exif \
        --enable-ftp \
        --enable-sockets \
        --enable-soap \
        --enable-mbstring \
        --enable-intl

Cross your fingers and run:
Bash:
./build php_expert 7.4 php-fpm

Great... :)

Another question, do I have to rebuild php 8.1 also?
I need 2 versions php, version 7.4 and 8.1

Currently I have php 8.1 only with SSL 3.0
 
@alex2k no, you need old Openssl only for php versions which didn't support new one and can't be compiled with it.
 
@mmx I follow your instruction but got this error:

Configuring php-7.4.33...
Patching php-fpm for per-user process grouping
patching file sapi/fpm/fpm/fpm_children.c
Patching php-fpm to not fail on startup if User quota maxed out on socket chown
patching file sapi/fpm/fpm/fpm_unix.c
Hunk #1 succeeded at 242 (offset 7 lines).
/proc/self/fd/3: line 9133: /usr/local/directadmin/custombuild/custom/php/configure.php74: Permission denied

*** There was an error while trying to configure php. Check the configure file
 
why install old versions to be garbage server afterwards, seriously ..
 
why install old versions to be garbage server afterwards, seriously ..

Not all scripts/software have been updated to support newer versions of PHP, and not all website owners have the skill/desire/funding/need/etc to do so.

In an ideal world, all websites would run PHP 8.0 or above - but the world we live in is far from ideal.
 
I agree with you, but there are so many servers in the world that some of them don't have facilities management and leave lots of servers that aren't up to date for months, years, and then they get hacked, malwareed to death and left running without the provider being able to remove them without the subscription being paid.

So for me it's a story, but a very dangerous one.
 
@mmx I follow your instruction but got this error:

As mentioned, it's likely a permission issue. Try:

Bash:
chown -R root:root /usr/local/directadmin/custombuild/custom
chmod 755 /usr/local/directadmin/custombuild/custom/php/configure.php74
 
I agree with you, but there are so many servers in the world that some of them don't have facilities management and leave lots of servers that aren't up to date for months, years, and then they get hacked, malwareed to death and left running without the provider being able to remove them without the subscription being paid.

So for me it's a story, but a very dangerous one.

Wait till I tell you about my client's Magento CE 1.7.0.2 installation using PHP 5.6.34 running on FreeBSD 10.3.
 
Clients understand they do need to update their Windows and Office every time and their car etc. etc. and they give money for it. But as soon as it comes to websites, some turn blind that these have too be updated to and yes this will also cost money in most cases.

Anyway, some hosting party's choose to keep providing those customers with all risks involved.
It's their own choice, as long as they don't complaint when things go sideways and don't request application devs (like DA and others) to keep supporting the ancient stuff with updates or fixes, it's their own responsibility. ;)
At least a few of them are professional enough to keep things safe enough and monitor it so it won't hurt others.
 
As mentioned, it's likely a permission issue. Try:

Bash:
chown -R root:root /usr/local/directadmin/custombuild/custom
chmod 755 /usr/local/directadmin/custombuild/custom/php/configure.php74
Thank you, it's working now :)
 
For interest -
 
Back
Top