How to install php5-memcached on Debian 7 with PHP 5.5?

14,504

Solution 1

I've got it installed. Somehow...

I tried to install libmemcached11. Since the installation with apt-get didn't work, I installed it from the source:

root@devvm:~# wget http://ftp.de.debian.org/debian/pool/main/libm/libmemcached/libmemcached11_1.0.17-2_amd64.deb
...
2013-07-23 22:07:02 (713 KB/s) - `libmemcached11_1.0.17-2_amd64.deb' saved [112238/112238]

root@devvm:~# dpkg --install libmemcached11_1.0.17-2_amd64.deb 
Selecting previously unselected package libmemcached11:amd64.
(Reading database ... 149070 files and directories currently installed.)
Unpacking libmemcached11:amd64 (from libmemcached11_1.0.17-2_amd64.deb) ...
dpkg: dependency problems prevent configuration of libmemcached11:amd64:
 libmemcached11:amd64 depends on libc6 (>= 2.16); however:
  Version of libc6:amd64 on system is 2.13-38.

dpkg: error processing libmemcached11:amd64 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libmemcached11:amd64

With errors, as you see. But now libmemcached11 was installed.

Since I thought, that the installation failed, I first desided to remove the downloaded (broken?) package, but aborted the process, in order to try the php5-memcached installation with it (maybe it would work... somehow...):

root@devvm:~# apt-get remove libmemcached11
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
...
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libmemcached11
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 261 kB disk space will be freed.
Do you want to continue [Y/n]? n
Abort.

Then I tried to install php5-memcached again -- and this time successfully:

root@devvm:~# apt-get -t stable install php5-memcached
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
...
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libmemcached11
The following NEW packages will be installed:
  libmemcached11 php5-memcached
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 148 kB of archives.
After this operation, 397 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://packages.dotdeb.org/ wheezy/all libmemcached11 amd64 1.0.16-1 [113 kB]
Get:2 http://packages.dotdeb.org/ wheezy-php55/all php5-memcached amd64 5.5.0-1~dotdeb.1 [34.9 kB]
Fetched 148 kB in 0s (328 kB/s)      
Selecting previously unselected package libmemcached11:amd64.
(Reading database ... 149070 files and directories currently installed.)
Unpacking libmemcached11:amd64 (from .../libmemcached11_1.0.16-1_amd64.deb) ...
Selecting previously unselected package php5-memcached.
Unpacking php5-memcached (from .../php5-memcached_5.5.0-1~dotdeb.1_amd64.deb) ...
Processing triggers for php5-fpm ...
[ ok ] Restarting PHP5 FastCGI Process Manager: php5-fpm.
Setting up libmemcached11:amd64 (1.0.16-1) ...
Setting up php5-memcached (5.5.0-1~dotdeb.1) ...

Creating config file /etc/php5/mods-available/memcached.ini with new version
Processing triggers for php5-fpm ...
[ ok ] Restarting PHP5 FastCGI Process Manager: php5-fpm.

Solution 2

To solve your problem, you just have to add the following to your sources.list :

# Wheezy
deb http://ftp.hosteurope.de/mirror/packages.dotdeb.org/ wheezy all
deb-src http://ftp.hosteurope.de/mirror/packages.dotdeb.org/ wheezy all

# Wheezy-php55
deb http://ftp.hosteurope.de/mirror/packages.dotdeb.org/ wheezy-php55 all
deb-src http://ftp.hosteurope.de/mirror/packages.dotdeb.org/ wheezy-php55 all

Indeed, the missing dependency (libmemcached11) is present in the wheezy distribution of the dotdeb repository.

Solution 3

Trying with release tag

Since you have repositories that are not of Debian, lets specify apt-get from where you want the package. Try using:

sudo apt-get -t stable install php5-memcached

That will fix your dependency problems since it will install php5-memcached and libmemcached10 from the stable repositories.

The pinning way

Since apt-get -t stable takes that dotdeb.org as latest stable version of the package, is either, disabling the mirror, apt-get update and installing the package or using pinning magic. Create the file /etc/apt/preferences.d/aptpinning with this content:

Package: php5-memcached
Pin: origin "ftp.de.debian.org"
Pin-Priority: 990

Package: php5-memcached
Pin: origin "packages.dotdeb.org"
Pin-Priority: 500

This will give the priority to the package from ftp.de.debian.org over the one from packages.dotdeb.org.

Again, mixing repos is bad idea, since this kind of situations can (and already) happen. Unless is something critical, you should not mix repos that can cause broken dependencies.

Maybe you need the backport repo

If the reason why you are using PHP from another source is about "security", you could be better using the wheezy-backport repositories. Just add deb http://YOURMIRROR.debian.org/debian wheezy-backports main to your sources.list, run apt-get update, then install the package using apt-get -t wheezy-backports install "package". If you try this, please revert any change of using the other methods.

Solution 4

Make sure you have

deb http://packages.dotdeb.org wheezy all

in your sources! See PHP 5.5.6, for Debian 7.0 “Wheezy”. Worked for me.

Share:
14,504

Related videos on Youtube

Nathan
Author by

Nathan

Updated on September 18, 2022

Comments

  • Nathan
    Nathan over 1 year

    My attempts to install the PHP 5 Memcached module on my Debian 7 VirtualBox VM failed:

    root@testvm:~# apt-get install php5-memcached
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     php5-memcached : Depends: libmemcached11 but it is not installable
    E: Unable to correct problems, you have held broken packages.
    

    I also could not install it over Synaptic Package Manager.

    I guess, the problem can lie in the missing source information in /etc/apt/sources.list.


    UPDATE:

    /etc/apt/sources.list

    # deb cdrom:[Debian GNU/Linux 7.1.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130615-23:04]/ wheezy main
    
    # deb cdrom:[Debian GNU/Linux 7.1.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130615-23:04]/ wheezy main
    
    deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free
    deb-src http://ftp.de.debian.org/debian/ wheezy main contrib non-free
    
    deb http://security.debian.org/ wheezy/updates main contrib non-free
    deb-src http://security.debian.org/ wheezy/updates main contrib non-free
    
    # wheezy-updates, previously known as 'volatile'
    deb http://ftp.de.debian.org/debian/ wheezy-updates main contrib non-free
    deb-src http://ftp.de.debian.org/debian/ wheezy-updates main contrib non-free
    
    # nginx
    deb http://packages.dotdeb.org wheezy all
    deb-src http://packages.dotdeb.org wheezy all
    
    # PHP 5.5
    deb http://packages.dotdeb.org wheezy-php55 all
    deb-src http://packages.dotdeb.org wheezy-php55 all
    

    UPDATE:

    I tried to install the missing dependency manually, but it also doesn't work:

    root@devvm:~# apt-get install libmemcached11
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package libmemcached11 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'libmemcached11' has no installation candidate
    

    UPDATE:

    root@devvm:~# apt-cache depends php5-memcached libmemcached10
    php5-memcached
      Depends: libc6
      Depends: <libmemcached11>
      Depends: zlib1g
      Depends: <phpapi-20121212>
        libapache2-mod-php5filter
        libapache2-mod-php5
        libphp5-embed
        php5-cgi
        php5-cli
        php5-fpm
      Depends: php5-common
     |PreDepends: dpkg
      PreDepends: <dpkg-maintscript-helper>
    libmemcached10
      Depends: libc6
      Depends: libgcc1
      Depends: libstdc++6
      PreDepends: multiarch-support
      Conflicts: <libmemcached2>
      Conflicts: <libmemcached3>
      Conflicts: <libmemcached6>
      Conflicts: <libmemcached9>
    
    • Admin
      Admin almost 11 years
      @EightBitTony I just want to install php5-memcached. It should work with apt-get install, but it doesn't. Just tried it with the Debian installation package. It also doesn't work -- because of the dependencies. Sorry, but I'm not really getting, what you mean with "php5-memcached is in Wheezy" and "you're installing it from somewhere else". Should I install all dependencies manually?
    • Admin
      Admin almost 11 years
      You have non-Debian sources in your sources.list. Unless you know you need them you should remove them.
  • Nathan
    Nathan almost 11 years
    Thank you for your answer, but also for the comments! 1. libmemcached11 and not libmemcached10 dependency. I see it now. Do you have an idea, why it needs 11 instead of 10 and how to change this? 2. wheezy-php55 sources. I need(-ed) them in order to install PHP 5.5. Do I still need them now, when PHP 5.5 is already installed. 3. To try Debian Test / Debian Unstable -- what do you mean? 4. Why Ubuntu Server? 5. Thank you for the hint to understand, how it works. Yes, I actually have to. But now I have to get php5-memcached installed first.
  • EightBitTony
    EightBitTony almost 11 years
    Stackexchange isn't the place for sprawling discussion, I've answered the specific query you had, and expanded it to cover some of your questions here, but you sound like you need to do a lot more reading about Debian, or use the StackExchange chat room stuff.
  • Nathan
    Nathan almost 11 years
    You are right, SO is not the place for discussions. It's a question-answer plattform. I asked a question (describing the issue), you gave an answer. The problem is still not resolved. That's why I asked further questions, in order to understand your answer and to achieve the goal of question -- problem solution.
  • Nathan
    Nathan almost 11 years
    apt-get -t stable install php5-memcached Didn't work: php5-memcached : Depends: libmemcached11 but it is not installable E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
  • Nathan
    Nathan almost 11 years
    Just updateed the question with the output of apt-cache depends php5-memcached libmemcached10.
  • Ludwig Schulze
    Ludwig Schulze almost 11 years
    @automatix I updated my answer as well.
  • Nathan
    Nathan almost 11 years
    Thank you very much for all your efforts! I have not tried your last solution out, since I've just got php5-memcached installed another way. See my answer.
  • Ludwig Schulze
    Ludwig Schulze almost 11 years
    Get:1 http://packages.dotdeb.org/ wheezy/all libmemcached11 amd64 1.0.16-1 [113 kB] you were trolled. Don't know why it wasn't included in repository.
  • Nathan
    Nathan almost 11 years
    Could you please explain, what you mean? I was trolled? What wasn't included to repository?
  • Ludwig Schulze
    Ludwig Schulze almost 11 years
    libmemcached11 was not included before in any of your repositories, hence it was added recently and you spent 2 days figuring out 'what was wrong'.