执行后出现以下错误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)
之后,我尝试了sudo apt-get install -f
、sudo dpkg --configure -a
和sudo apt-get install --reinstall php5
,所有这些都出现了相同的错误。
我该如何修复这个问题?
答案1
答案2
我刚才遇到了同样的问题,这是第一个结果,它没有解决我的问题,所以我想在这里留下我的解决方案。我发现了一个由于在 /var/lib/php5/modules/registry 中不正确运行 php5enmod 而创建的虚假文件。一旦我从那里删除了不是实际 php5 模块的文件,一切就开始工作了。
答案3
这对我有用
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
答案4
开发deb.sury.org
者 Ondřej Surý 不想修复它:
您很可能在包之间符号链接了 php.ini。这是不支持的。
github.com/oerdnj/deb.sury.org/issues/1473#issuecomment-713839096
所以我自己通过修补文件夹deb.sury.org
中的文件来修复它/var/lib/dpkg/info/
。
我记录了我的解决方案PHP 7.4这里:df.tips/t/1940/3
对于其他 PHP 版本,情况类似。