Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I had to do a Debian dist-upgrade on my server... in the process, PHP got upgraded to 5.4. We use ioncube which only supports up to 5.3 atm, and I'm having some trouble finding how to downgrade to 5.3 from 5.4. Anyone know how?

share|improve this question

migrated from stackoverflow.com Mar 9 '12 at 2:02

This question came from our site for professional and enthusiast programmers.

3  
I certainly hope this doesn't mean you're using debian unstable (sid) on a server. Because that'd be a really, really, really bad idea. –  duskwuff Mar 8 '12 at 18:04
    
I had to do a dist-upgrade to meet certain requirements for PCI compliance –  Carnivoris Mar 8 '12 at 18:08
2  
Sid is named after the evil kid in Toy Story. He breaks toys. And servers. –  duskwuff Mar 8 '12 at 18:16
    
If the packages.debian.com site is up-to-date (which I would believe that it is) then you must be on Debian Unstable. A dist-upgrade would not move you to a different release. –  AndrewR Mar 8 '12 at 18:17
    
@duskwuff it's called unstable but it's not really unstable. In some occasions it may be better than the stable release. Obviously on a public server is not often the best solution, because it doesn't get fast security updates by the debian security team... –  dAm2K Mar 8 '12 at 18:45

4 Answers 4

Neither of the solutions above worked for me. What did work was pinning the necessary packages to the old stable such as

Add the following to /etc/apt/sources.lst

deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

Create

/etc/apt/preferences.d/preferences

And add the packages you need downgraded such as in my case

Package: php5*
Pin: release a=oldstable
Pin-Priority: 700

Package: libapache2-mod-php5    
Pin: release a=oldstable
Pin-Priority: 700

Package: libapache2-mod-php5
Pin: release a=oldstable
Pin-Priority: 700

Package: php-pear
Pin: release a=oldstable
Pin-Priority: 700

Package: *
Pin: release a=stable
Pin-Priority: 600

Then run the commands

aptitude update
aptitude reinstall <necessary packages>
/etc/init.d/apache2 restart

If you want to know which packages you need to upgrade just run :

dpkg -l|grep php|grep 5.4|awk '{print $2}'
share|improve this answer
    
worked fine for me! thank you very much –  Stephan Jul 5 '13 at 19:04

You could try this, but do it at your own risk. I didn't try it myself. ;)

  • apt-get remove php5
  • Download the PHP5 package from Stable
  • dpkg --force php5_5.3.3-7+squeeze8_all.deb
  • dpkg --set-selections PHP5 hold

The last line to prevent upgrading to 5.4. When you're ready for 5.4, run dpkg --set-selections PHP5 install

IonCube for 5.4 is a little while out from what I've read.

share|improve this answer
    
I've got this dpkg: error: unknown force/refuse option 'php5_5.3.3-7+squeeze13_all.deb' –  holms Aug 8 '12 at 15:55
    
If you're still working on this, you should know that IonCube has been upgraded to work with PHP 5.4. Just stick with PHP 5.4 and download the latest IonCube libraries. –  AndrewR Aug 10 '12 at 0:32

Downgrading PHP 5.4 to 5.3

First check which versions are supported for php5:

apt-cache showpkg php5

Here is the script which you could find it useful (it removes PHP 5.4 and install PHP 5.3):

sudo apt-get remove --purge `dpkg -l | grep php | grep -w 5.4 | awk '{print $2}' | xargs`
VERSION="php5_5.3.3-7+squeeze8_all" # CHANGES THIS WITH YOUR VERSION OF PACKAGE
sudo apt-get install php5=$VERSION php5-cli=$VERSION php5-common=$VERSION libapache2-mod-php5=$VERSION
sudo apt-get install php5=$VERSION php5-cli=$VERSION php5-common=$VERSION libapache2-mod-php5=$VERSION
sudo apt-get install php-pear=$VERSION php5-curl=$VERSION php5-gd=$VERSION php5-intl=$VERSION php5-mysql=$VERSION php5-pspell=$VERSION php5-recode=$VERSION php5-snmp=$VERSION php5-sqlite=$VERSION php5-tidy=$VERSION php5-xmlrpc=$VERSION php5-xsl=$VERSION

Where the available versions you can check by command: apt-cache showpkg php5

After the installation, verify it by command: php --version

Please be careful and don't install any other packages without package version specified (like php5-xcache), otherwise apt-get will replace your PHP instance with 5.4 again!

To prevent this happening, you can hold these packages.

Holding packages using dpkg

To hold packages by dpkg, you can execute the following command:

echo "php5 hold" | sudo dpkg --set-selections

To hold all PHP packages, run the following command:

dpkg --get-selections | grep ^php5 | sed s/install/hold/g | sudo dpkg --set-selections

The following command will show you holding status of your php packages:

sudo dpkg --get-selections | grep ^php

Holding packages using aptitude

You can also hold packages using aptitude e.g.:

sudo aptitude hold php5

Unhold:

sudo aptitude unhold php5

Extras

See also the same questions for Ubuntu, for some more ideas.

share|improve this answer

I had to do a full upgrade to wheezy by changing my apt sources to the wheezy sources. Uninstalled php, upgraded the system with the new apt sources, installed php... everything's golden.

share|improve this answer
    
which sources you could at least post them. my apt sources doesn't have any php5.3 in there =/ –  holms Aug 8 '12 at 15:58
    
Not an answer at all... –  pduersteler Jun 25 '13 at 11:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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