Unable to install PHP5-APC

oliviermis asked:

When trying to install php5-apc, getting this error :

[email protected]:/etc/apt# apt-get install php5-apc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 70.4 kB of archives.
After this operation, 211 kB of additional disk space will be used.
Get:1 http://packages.dotdeb.org/ stable/all php5-apc amd64 5.4.23-1~dotdeb.1 [70.4 kB]
Fetched 70.4 kB in 0s (726 kB/s)
(Reading database ... 48129 files and directories currently installed.)
Unpacking php5-apc (from .../php5-apc_5.4.23-1~dotdeb.1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/php5-apc_5.4.23-1~dotdeb.1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/php5/20100525/apc.so', which is also in package php-apc 3.1.13-1
Processing triggers for php5-fpm ...
[ ok ] Restarting PHP5 FastCGI Process Manager: php5-fpm.
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I am running Debian 7 Wheezy & PHP5-FPM.

My answer:

You have a conflicting package, php-apc which you need to remove first, before replacing it with the third party package.

Start over:

apt-get remove php-apc php5-apc

Then try again:

apt-get install php5-apc

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.