Downgrade php5.3 to php5.2 on Debian squeeze

An alternative to downgrading is to install both versions in parallel:

  1. find all installed packages
dpkg -l | grep -i php
  1. remove them
apt-get remove <package>
  1. add the lenny sources to /etc/apt/source.list

  2. pin the version of php and of related packages by creating the following file


Package: libapache2-mod-php5 libapache2-mod-php5filter
Pin: version 5.2*
Pin-Priority: 1001

Package: php5-suhosin
Pin: version 0.9.2*
Pin-Priority: 1001

Package: php5 php5-cgi php5-cli php5-common php5-curl php5-dbg php5-dev php5-enchant php5-gd php5-gmp
Pin: version 5.2*
Pin-Priority: 1001

Package: php5-imagick php5-imap php5-interbase php5-intl php5-ldap php5-mcrypt php5-mhash php5-mysql php5-odbc php5-pgsql
Pin: version 5.2*
Pin-Priority: 1001

Package: php5-pspell php5-recode php5-snmp php5-sqlite php5-sybase php5-tidy php5-xmlrpc php5-xsl php-pear
Pin: version 5.2*
Pin-Priority: 1001

Package: php-benchmark
Pin: version 1.2.7*
Pin-Priority: 1001

Package: php-compat
Pin: version 1.5.0*
Pin-Priority: 1001

Package: php-http
Pin: version 1.4.0*
Pin-Priority: 1001

Package: php-http-request
Pin: version 1.4.2*
Pin-Priority: 1001

Package: php-net-socket
Pin: version 1.0.8*
Pin-Priority: 1001

Package: php-net-url
Pin: version 1.0.15*
Pin-Priority: 1001

Package: php5-xdebug
Pin: version 2.0.3*
Pin-Priority: 1001

Simulate the installation

 apt-get install -s php5 libapache2-mod-php5 php5-cli php5-common php5-curl php5-gd php5-mcrypt php5-mysql php5-suhosin

if everything is OK run the real installation by skipping the -s option.

Otherwise check the broken packages with the following command and pin the needed version in apt-cache policy php5-suhosin

apt-cache policy <broken backage name> 
  1. restart apache
/etc/init.d/apache restart

see also:

Apt preference files for other distributions and versions

  • Ubuntu 11.10 attachment:"php5"

Updated by Andreas Kohlbecker over 9 years ago ยท 4 revisions