Oli Oli - 1 month ago 20
PHP Question

Downgrade to PHP 5.4.45 in Phusion Docker

I'm running a dev environment using Docker and https://github.com/phusion/baseimage-docker.

I've tried installing PHP 5.4.45 on it, but I always get a PHP 5.5.9 version when running

apt-cache policy php5
.

Every guide uses
sudo add-apt-repository ppa:ondrej/php5-oldstable
, which I installed but it doesn't work..any ideas?

This is one of the guides I tried: https://www.dev-metal.com/how-to-install-latest-php-5-4-x-on-ubuntu-12-04-lts-precise-pangolin/

Oli Oli
Answer

So the phusion:baseimage:latest will (at the moment) use Ubuntu 16.04.

The PHP 5.4 repository will only work with Ubuntu 12.04.

This is how I got it working:

1: Start a container based on Phusion 0.9.9 (which is based on Ubuntu 12.04):

docker run phusion/baseimage:0.9.9

2: Lookup the name of the container and enter it

3: run following commands:

apt-get update && apt-get install -y python-software-properties software-properties-common
export LC_ALL=en_US.UTF-8
add-apt-repository ppa:ondrej/php5-oldstable
apt-get update
apt-cache policy php5

4: output will be:

php5:
  Installed: (none)
  Candidate: 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1
  Version table:
     5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1 0
        500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
     5.3.10-1ubuntu3.25 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     5.3.10-1ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
Comments