Skip to content

Instantly share code, notes, and snippets.

Last active October 22, 2021 16:08
What would you like to do?
Instal php5.6 with phpbrew on ubuntu 18.04
# Instal php5.6 with phpbrew on ubuntu 18.04
# Install all dependencies
sudo apt update
sudo apt install wget php build-essential libxml2-dev libxslt1-dev libbz2-dev libcurl4-openssl-dev libmcrypt-dev libreadline-dev libssl-dev autoconf
chmod +x phpbrew
mv phpbrew /usr/local/bin
phpbrew init
source ~/.phpbrew/bashrc
# because of this bug
# we need to do this
sudo ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
# download openssl
tar -xzvf openssl-1.0.2o.tar.gz
pushd openssl-1.0.2o
# we will install it in /usr/local/openssl so it don't interfere with openssl from apt
# we will compile it as dynamic library
./config -fPIC shared --prefix=/usr/local --openssldir=/usr/local/openssl
# classic make
# test it
make test
# install
sudo make install
# build php with shared openssl dependency
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# this command doesn't work
# phpbrew -d install php-5.6 +default +openssl=shared
# to install default extensions and openssl, we have to use the following command
phpbrew -d install php-5.6 +default -- --with-openssl=shared
phpbrew use $(phpbrew list | grep php-5.6)
phpbrew -d ext install openssl
# confirmation
php -m | grep openssl
Copy link

Potherca commented Aug 28, 2019

I can verify this works for PHP 5.4 and 7.1 as well. 👍

Copy link

tim-itwakes commented Jan 13, 2020

using this script to install PHP 5.4 and 7.3 in Ubuntu Desktop 19.10 👍👍 Thanks!

Copy link

koji9412 commented Jun 4, 2020

I succeeded in installing PHP 5.6.40 and PHP 7.2.6 on Ubuntu Desktop 18.04👍👍👍

Copy link

juanjux commented Jul 23, 2020

Need to add the php-bz2 package for me to work on 20.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment