1

I need to downgrade my PHP from 5.6 to 5.5

Here is what I've done so far

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

Then

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y php5

Then I tried

sudo apt-get install php5

and

sudo apt-get install php5=5.5.26+dfsg-1+deb.sury.org~vivid+1

This is what I get when I run apt-cache policy php5

php5:
  Installé : (aucun)
  Candidat : 5.6.4+dfsg-4ubuntu6.2
 Table de version :
     5.6.4+dfsg-4ubuntu6.2 0
        500 http://fr.archive.ubuntu.com/ubuntu/ vivid-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ vivid-security/main amd64 Packages
     5.6.4+dfsg-4ubuntu6 0
        500 http://fr.archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
     5.5.26+dfsg-1+deb.sury.org~vivid+1 0
        500 http://ppa.launchpad.net/ondrej/php5/ubuntu/ vivid/main amd64 Packages

No matter what I do, PHP 5.6 is installed. I even tried with Synaptic, without success.

Any idea ?

Hakim
  • 111
  • 1
  • 6
  • What's the actual output when you run sudo apt-get install php5=5.5.26+dfsg-1+deb.sury.org~vivid+1? – muru Jul 13 '15 at 14:15
  • The same output as a normal installation of PHP. Like unpacking of php5-common (5.6.4+dfsg-4ubuntu6.2) ... – Hakim Jul 13 '15 at 14:21

1 Answers1

0

The PPA packages have a >= dependency relationship for many packages:

Package: php5
Version: 5.5.26+dfsg-1+deb.sury.org~vivid+1
Depends: libapache2-mod-php5 (>= 5.5.26+dfsg-1+deb.sury.org~vivid+1~) | libapache2-mod-php5filter (>= 5.5.26+dfsg-1+deb.sury.org~vivid+1~) | php5-cgi (>= 5.5.26+dfsg-1+deb.sury.org~vivid+1~) | php5-fpm (>= 5.5.26+dfsg-1+deb.sury.org~vivid+1~), php5-common (>= 5.5.26+dfsg-1+deb.sury.org~vivid+1~)

So, if you want to install a specific version of all of them, you'll likely have to specify individual packages with the version specified:

sudo apt-get install {php5,libapache2-mod-php5,php5-common}=5.5.26+dfsg-1+deb.sury.org~vivid+1

Or use pinning so that the PPA has a higher priority than the Ubuntu repositories.

muru
  • 197,895
  • 55
  • 485
  • 740
  • I tried the command you gave me, but I get errors E: The version « 5.5.26+dfsg-1+deb.sury.org~vivid+1~ » of « php5 » could not be found. It seems overcomplicated. For the pinning, its seems more adapted to a situation where you want to upgrade from a stable release than downgrade to older packages. Anyway, thank you for your help – Hakim Jul 13 '15 at 14:47
  • @Hakim the trailing ~ was a copy paste error. Try without it. – muru Jul 13 '15 at 14:49
  • Yes, that's better, but there are still a lot of conflicts, due to dependencies, like libapache2-mod-php5 (< 5.6.4+dfsg-3~). Isn't there a way to specify which version of PHP we want to install, and it would get the dependencies it needs ? – Hakim Jul 13 '15 at 15:02
  • @Hakim It's in the works, but not right now, it seems. You could try building up from php5-common and installing each additional package individually to see where things go wrong. – muru Jul 13 '15 at 15:06
  • thanks, i'll try that. If I can't get it to work, i'll try to mount a vagrant image, it might be simpler. Thanks for your help – Hakim Jul 13 '15 at 15:18
  • @Hakim Try installing the debug package (php5-dbg). It depends on exact versions (=, not >=). – muru Jul 13 '15 at 22:21