5

By default in Debian Jessie, I get PHP 5.6 installed by using apt-get install php5 . The problem is that the project that I'm working on has severely deprecated functions to the point that the project isn't working properly, and I have failed to suppress any of those deprecation warnings. They just won't go away.

After consulting with one of my colleagues, I've decided to install an older version of PHP, namely 5.3.10. This is the version he's using and the project is running fine.

I've been searching around the debian packages and I've managed to install PHP 5.3.29 (for Wheezy), but again the project is not working at all.

How would I get around installing a 5.3.10 on Jessie? I have found the required source here. http://php.net/releases/ But I honestly do not know what features I need from PHP and I also do not understand what apache folder I need to use when building. Online guides showed something similar to apache/bin, but I am not aware of such a folder on my PC (yes, apache is installed and working properly).

Is there a different way, or am I stuck to building PHP from scratch? There is virtually no 5.3.10 package in the jessie repos. Only 5.6.

12

I wouldn't recommend going backwards on PHP versions but if you have no other choice then simply add a Debian snapshot to your repo and then install passing the version number.

You can view a full explanation here: http://mstd.eu/index.php/2016/07/04/install-old-versions-of-software-on-debian-like-php-5-3/

You can find all the information you need here: http://snapshot.debian.org

But if you're lazy (like me) just copy and paste the following:

Add the source lists:

deb http://snapshot.debian.org/archive/debian/20120221T041601Z/ unstable main
deb-src http://snapshot.debian.org/archive/debian/20120221T041601Z/ unstable main

Now update apt but ignore expiry dates:

apt-get -o Acquire::Check-Valid-Until=false update

Now you can pass in the version number you need 5.3.10-2 in this case

apt-get install php5=5.3.10-2

A bit more info if you was wondering on how I got to this, if you find the package you need on a snapshot in this case here: http://snapshot.debian.org/package/php5/5.3.10-2/ it gives you the date it was first added 2012-02-21 04:16:01 so then you simply add this into the snapshot source list like so:

http://snapshot.debian.org/archive/debian/yyyymmddThhmmssZ

In the case above this translates to:

deb http://snapshot.debian.org/archive/debian/20120221T041601Z/
  • Thank you a lot for your reply. It seems to have worked, but I ran into another huge issue. I tried purging php5 from my system using apt-get purge php*. This seemed to have done the trick, but after I installed php 5.3.10 as you instructed, if I print out phpinfo() it shows me that version 5.6.7-1, and if I type php -v in the terminal emulator, it sais that there is a php 5.3.29 present on my system..? I also tried purging apache and deleting both apache and php folders to no avail. Did I do anything wrong? Shouldn't apt-get purge uninstall the given packages? and why 2 php versions? – xIcarus May 12 '15 at 16:57
  • Update: i managed to purge out all php versions in my system. But when I try to install php 5.3.10 again like you instructed, it just installs php 5.6.7-1 for some reason.. Any ideas? I even tried with aptitude (although it shouldn't make a difference) but to no avail. – xIcarus May 13 '15 at 8:31
  • @xIcarus sorry only just seen your replay, I don't always get updates for some reason. I only have one live Debian system so can't really test at the moment, what version is returned when you run apt-cache policy php5? – twigg May 13 '15 at 10:29
  • @xIcarus sorry I had a typo in my above packages make sure the second one reads 'deb-src' and not 'deb-src deb'. First thing, remove all php versions you have installed. Open /etc/apt/sources.list in nano or vim, make sure the above two source lists are added, then run 'apt-get -o Acquire::Check-Valid-Until=false update' and then run 'apt-cache policy php5' you should see both version 5.6.x and 5.3.10-2. Then install passing the version number 'apt-get install php5=5.3.10-2' – twigg May 13 '15 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.