5

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?

1
  • Try removing php5-fpm first, using dpkg -r php5-fpm
    – wurtel
    Feb 20, 2015 at 8:19

4 Answers 4

9

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.

2
  • Well, that is irritating.
    – trey-jones
    Aug 25, 2016 at 12:35
  • This resolved my issue as well. sudo unlink php.ini Oct 24, 2017 at 22:07
1

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.

0

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
1
  • This seems incoherent. What is accomplished by showing the policy (source) of the package? The repeated apt-get clean invocations make no sense. Likewise, screwing around with php5-cli package metadata can cause further problems - do you want to remove the maintainer scripts, empty the package file list, or? It hardly makes any sense. Mar 2, 2018 at 19:32
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .