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

I have Debian squeeze installed and this is my /etc/apt/sources.list file:

# Debian packages for stable
deb http://ftp.lug.ro/debian/ stable main contrib non-free

# Security updates for stable
deb http://security.debian.org/ stable/updates main contrib non-free

# DotDeb - http://www.dotdeb.org/
deb ftp://download.srv.ro/pub/dotdeb/ stable all
deb-src ftp://download.srv.ro/pub/dotdeb stable all

What I am trying to do is to set up a pin so I can install only the php5 package from dotdeb, and ignore everything else from this repository. I tried this:

# cat /etc/apt/preferences
Package: *
Pin: release o=packages.dotdeb.org
Pin-Priority: 100

Package: php5
Pin: release o=packages.dotdeb.org
Pin-Priority: 900

# apt-cache policy php5
php5:
  Installed: 5.3.3-7+squeeze14
  Candidate: 5.3.17-1~dotdeb.0
  Package pin: 5.3.17-1~dotdeb.0
  Version table:
     5.3.17-1~dotdeb.0 900
        100 ftp://download.srv.ro/pub/dotdeb/ stable/all i386 Packages
 *** 5.3.3-7+squeeze14 900
        500 http://ftp.lug.ro/debian/ stable/main i386 Packages
        500 http://security.debian.org/ stable/updates/main i386 Packages
        100 /var/lib/dpkg/status

but with no luck. Perhaps I don't understand very well how pinning works.

UPDATE

Running apt-get -s upgrade gives me:

# apt-get -s upgrade
<-- output clipped -->
The following packages have been kept back:
  php5
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Also, I just noticed that running apt-get -s install php5 gives me:

# apt-get -s install php5
<-- output clipped -->
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php5 : Depends: libapache2-mod-php5 (>= 5.3.17-1~dotdeb.0) but 5.3.3-7+squeeze14 is to be installed or
                 libapache2-mod-php5filter (>= 5.3.17-1~dotdeb.0) but it is not going to be installed or
                 php5-cgi (>= 5.3.17-1~dotdeb.0) but 5.3.3-7+squeeze14 is to be installed or
                 php5-fpm (>= 5.3.17-1~dotdeb.0) but it is not going to be installed
        Depends: php5-common (>= 5.3.17-1~dotdeb.0) but 5.3.3-7+squeeze14 is to be installed
E: Broken packages

So this might be the reason the package is not installed. If indeed this is the problem, how can I pin multiple packages at once? Or should I pin manually each package?

share|improve this question
    
What message are you getting when you try to upgrade? –  DerfK Oct 3 '12 at 23:35
    
I updated my question –  s3v3n Oct 3 '12 at 23:52
add comment

2 Answers

You can't pin and/or install only the php5 package. Aside from being a "meta" package that installs other packages, PHP has a number of different modules that will need to be installed too.

If you want to pin things this way, you'll need to pin (at a minimum) either libapache2-mod-php5 (or the filter version) or php5-cgi or php5-fpm for PHP itself, and the php5-common package. Any PHP modules you want will need to be pinned and installed from this repository as well, as will any libraries these plugins depend on that aren't the same version as in Debian stable.

share|improve this answer
    
Thank you for your answer! –  s3v3n Oct 4 '12 at 0:10
add comment
up vote 1 down vote accepted

The whole point of this was to have php with readline support so I can use php interractive mode with php -a. I found a nice post on how to setup the Dotdeb apt repository on Debian and used ran this command:

PACKAGES=$(command wget "http://packages.dotdeb.org/dists/squeeze/php5/binary-$(command dpkg --print-architecture)" \
--quiet --output-document=- \
| command grep "href=" | command grep -v "h1" | command grep -v "\.\./" \
| command sed -e 's/^[^>]*>\([^_]*\)_.*$/\1/' | command tr "\n" " ")

To get all php5 related packages and updated /etc/apt/preferences to look like this:

Package: *
Pin: release o=packages.dotdeb.org
Pin-Priority: 100

Package: libapache2-mod-php5 libapache2-mod-php5filter php-pear php5-cgi php5-cli php5-common php5-curl php5-dbg php5-dev php5-enchant php5-fpm php5-gd php5-gmp php5-imap php5-interbase php5-intl php5-ldap php5-mcrypt php5-mysql php5-odbc php5-pgsql php5-pspell php5-recode php5-snmp php5-sqlite php5-sybase php5-tidy php5-xmlrpc php5-xsl php5
Pin: release o=packages.dotdeb.org
Pin-Priority: 900

And now apt-get will install all the needed packages:

# apt-get -s install php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libapache2-mod-php5 php5-cli php5-common php5-curl
Suggested packages:
  php-pear
The following packages will be upgraded:
  libapache2-mod-php5 php5 php5-cli php5-common php5-curl
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst php5-cli [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386]) []
Inst php5-curl [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386]) []
Inst libapache2-mod-php5 [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386]) []
Inst php5-common [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Inst php5 [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [all])
Conf php5-common (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Conf php5-cli (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Conf libapache2-mod-php5 (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Conf php5-curl (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Conf php5 (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [all])
share|improve this answer
add comment

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.