compile php 5.6 ubuntu 20

howto compille php 5.6 on ubuntu 20

php5.6 is end of life, so, here we go

assume you’re in /home/xxx

[xxx@localhost ~]$ wget -O php-5.6.40.tar.gz
[xxx@localhost ~]$ tar -zxvf php-5.6.40.tar.gz
[xxx@localhost ~]$ mv php-5.6.40 php
[xxx@localhost ~]$ mkdir -p ./build
[xxx@localhost ~]$ mkdir -p ./src
[xxx@localhost ~]$ cd src
[xxx@localhost src]$ git clone
[xxx@localhost src]$ git clone

Open ssl 1.0.0

[xxx@localhost src]$ cd openssl
[xxx@localhost openssl]$ git checkout OpenSSL_1_0_0-stable

// Make sure Build is clean before recompiling

[xxx@localhost openssl]$ make clean
[xxx@localhost openssl]$ make dclean

// Configure OpenSSL

[xxx@localhost openssl]$ ./config -fPIC shared –prefix=/home/xxx/build

// Make OpenSSL & Install into Build Directory

[xxx@localhost openssl]$ make -j$(nproc)
[xxx@localhost openssl]$ make install

[xxx@localhost openssl]$ cd ~/build/bin
[xxx@localhost bin]$ ./openssl version
OpenSSL 1.0.0u-dev xx XXX xxxx
[xxx@localhost bin]$

Curl with openssl support

[xxx@localhost bin]$ cd ~/src/curl

// Run buildconf to create the autoconf file (may require sudo access)

[xxx@localhost curl]$ ./buildconf

// Configure cURL to point to OpenSSL 1.0.0 libraries, and install to Build directory

[xxx@localhost curl]$ env PKG_CONFIG_PATH=/home/xxx/build/lib/pkgconfig
[xxx@localhost curl]$ ./configure –with-ssl –prefix=/home/xxx/build

// Make & Install cURL to Build directory

[xxx@localhost curl]$ make -j$(nproc)
[xxx@localhost curl]$ make install

[xxx@localhost curl]$ cd ~/build/bin
[xxx@localhost bin]$ ./curl -V
curl 7.24.0 (x86_64-unknown-linux-gnu) libcurl/7.24.0 OpenSSL/1.0.0u zlib/1.2.11
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz

Compile php 5.6

// Generate autoconf files. May require sudo access.
[xxx@localhost bin]$ cd ~/php
[xxx@localhost php]$ ./buildconf

// Configure PHP 5.6 to point to the Build directory containing OpenSSL & cURL

[xxx@localhost php]$ ./configure \
–prefix=/opt/php56 \
–with-config-file-path=/opt/php56/etc \
–with-curl=/home/xxx/build \
–with-openssl-dir=/home/xxx/build \
–with-openssl=shared \
–with-pdo-mysql \
–with-fpm-user=apache \
–with-fpm-group=apache \
–with-libdir=lib64 \ ** Use if on 64 bit OS. Include softlink to lib directory

// Make & Install PHP 5.6

[xxx@localhost php]$ make clean
[xxx@localhost php]$ make -j$(nproc) -B
[xxx@localhost php]$ make install

[xxx@localhost php]$ /opt/php56/bin/php -v
PHP 5.6.40 (built: AugĀ  8 2021 03:51:44)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Leave a Reply

Your email address will not be published. Required fields are marked *