Skip to content

Instantly share code, notes, and snippets.

@marulitua
Last active November 16, 2023 00:38
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save marulitua/f8932064ec5bfe6a5be9fadac7c5a141 to your computer and use it in GitHub Desktop.
Save marulitua/f8932064ec5bfe6a5be9fadac7c5a141 to your computer and use it in GitHub Desktop.
Instal php5.6 with phpbrew on ubuntu 18.04
#!/bin/bash
# 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
wget https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
mv phpbrew /usr/local/bin
phpbrew init
source ~/.phpbrew/bashrc
# because of this bug https://github.com/phpbrew/phpbrew/issues/861
# we need to do this
sudo ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
# download openssl
wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz
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
make
# test it
make test
# install
sudo make install
popd
# 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
php -r "echo OPENSSL_VERSION_NUMBER;"
@tim-itwakes
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!

@koji9412
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๐Ÿ‘๐Ÿ‘๐Ÿ‘

@juanjux
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