Can't finish php5-cli update

I get the following error after doing sudo apt-get upgrade:

Setting up php5-cli (5.5.9+dfsg-1ubuntu4.6) ...
ucfr: Attempt from package php5-cli  to take /etc/php5/cli/php.ini away from package php5-fpm
ucfr: Aborting.
dpkg: error processing package php5-cli (--configure):
 subprocess installed post-installation script returned error exit status 4
dpkg: dependency problems prevent configuration of php5-readline:
 php5-readline depends on php5-cli (= 5.5.9+dfsg-1ubuntu4.6); however:
  Package php5-cli is not configured yet.

dpkg: error processing package php5-readline (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of php-pear:
 php-pear depends on php5-cli; however:
  Package php5-cli is not configured yet.

dpkg: error processing package php-pear (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Setting up php5 (5.5.9+dfsg-1ubuntu4.6) ...
Errors were encountered while processing:
 php5-cli
 php5-readline
 php-pear
E: Sub-process /usr/bin/dpkg returned an error code (1)

After that, I tried sudo apt-get install -f, sudo dpkg --configure -a and sudo apt-get install --reinstall php5, all of them with the same error.

How can I fixed this?

Asked By: jherran

||

To solve it, I had to remove the symlink in /etc/php5/cli/php.ini that points to ../fpm/php.ini.

After that, all works as expected.

I found the solution here.

Answered By: jherran

I ran into this same issue just now and this was the first result, and it didn’t solve my issue, so I wanted to leave my solution here. I found a bogus file that had been created due to improperly running php5enmod in
/var/lib/php5/modules/registry
Once I removed the file from there that wasn’t an actual php5 module everything started working.

Answered By: Michael Hogg

this works for me

cd /var/lib/dpkg/info/

apt-cache policy php5-cli

ls -l php5-cli.*

sudo apt-get clean

sudo rm -r php5-cli.*

sudo apt-get clean

sudo apt-get update

apt-get upgrade
Answered By: oxyOsky

The deb.sury.org developer Ondřej Surý does not want to fix it:

You most likely symlinked the php.ini between the packages. That’s not supported.

github.com/oerdnj/deb.sury.org/issues/1473#issuecomment-713839096

So I fixed it myself by patching deb.sury.org files in the /var/lib/dpkg/info/ folder.
I documented my solution for PHP 7.4 here: df.tips/t/1940/3
For other PHP versions it is similar.

Answered By: Dmitrii Fediuk
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.