2

In order to migrate old php software, I want to run php 5.3.* so I:

  1. Removed php via apt-get purge php*
  2. Added the corresponding http://snapshot.debian.org/archive/debian/ to the sources
  3. Installed apt-get install php5=5.3.10-2

Now if I do apt-cache policy php5 I get:

php5: Installed: 5.3.10-2 Candidate: 5.6.17+dfsg-0+deb8u1 Version table: 5.6.17+dfsg-0+deb8u1 0 500 http://ftp.debian.org/debian/ jessie/main amd64 Packages 5.6.14+dfsg-0+deb8u1 0 500 http://security.debian.org/ jessie/updates/main amd64 Packages *** 5.3.10-2 0 500 http://snapshot.debian.org/archive/debian/20120221T041601Z/ unstable/main amd64 Packages 100 /var/lib/dpkg/status 

So far so good, my nginx setup is like:

location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } 

But now if I do php -v I get:

PHP 5.6.17-0+deb8u1 (cli) (built: Jan 13 2016 09:10:12) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies 

And also if I serve <?php phpinfo(); ?> I get:

PHP Version 5.6.17-0+deb8u1 

dpkg -l php5* | egrep ^ii outputs:

ii php5 5.3.10-2 all server-side, HTML-embedded scripting language (metapackage) ii php5-cli 5.6.17+dfsg-0+deb8u1 amd64 command-line interpreter for the php5 scripting language ii php5-common 5.6.17+dfsg-0+deb8u1 amd64 Common files for packages built from the php5 source ii php5-fpm 5.6.17+dfsg-0+deb8u1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary) ii php5-json 1.3.6-1 amd64 JSON module for php5 ii php5-readline 5.6.17+dfsg-0+deb8u1 amd64 Readline module for php5 

So what are the necessary steps to actually run the older version of php?

Edit: I found this https://github.com/phpbrew/phpbrew really helpful tool. So if someone facing the same issue this might be a good solution.

3
  • 1
    Can you add the output of dpkg -l php5* | egrep ^ii? Commented Feb 3, 2016 at 14:05
  • 1
    Also: Maybe you have to run apt-get autoremove as well, apt-get purge php5 might not be sufficient and will leave packages it depends on your system, even if purged. It's a so called "metapackage", that's why this could / will happen. Run the command provided by @Weboide to check and be sure. Commented Feb 3, 2016 at 16:24
  • 1
    Also: To prevent this hassle, you could introduce "pinning" for certain packages. Read this as an introduction. Commented Feb 3, 2016 at 16:27

1 Answer 1

2

You will also need to run:

apt-get install php5-cli=5.3.10-2 php5-fpm=5.3.10-2 php5-common=5.3.10-2 php5-readline=5.3.10-2 

These were still on the 5.6 version, that's why you still see 5.6.

2
  • Thanks! Is trhis mandatory? Now I am getting a lot of unmet dependencies Commented Feb 3, 2016 at 14:47
  • at least php5-fpm and php5-common should get you going, if I'm not mistaken. But you may want to start from scratch, uninstall everything and then install those specifying the version number on all packages. Commented Feb 3, 2016 at 16:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.