php安装错误

当我执行

apt update && apt upgrade

的时候,不小心选错了选项,导致PHP升级失败

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up libapache2-mod-php7.2 (7.2.7-1+ubuntu18.04.1+deb.sury.org+1) ...
ucfr: Attempt from package libapache2-mod-php7.2  to take /etc/php/7.2/apache2/php.ini away from package php7.2-fpm
ucfr: Aborting.
dpkg: error processing package libapache2-mod-php7.2 (--configure):
 installed libapache2-mod-php7.2 package post-installation script subprocess returned error exit status 4
Errors were encountered while processing:
 libapache2-mod-php7.2
E: Sub-process /usr/bin/dpkg returned an error code (1)

的时候,除了提示
而且后面再使用apt的时候也是这些提示

而且怎么弄都没用
并且执行

apt-get autoremove
apt autoremove
apt-get clean
apt clean

dpkg -l |grep ^rc|awk '{print $2}' |xargs dpkg -P

之后还是提示同样的错误,并且还多了以下的提示

dpkg: error processing package libapache2-mod-php7.2 (--configure):
 installed libapache2-mod-php7.2 package post-installation script subprocess returned error exit status 4
Errors were encountered while processing:
 libapache2-mod-php7.2
E: Sub-process /usr/bin/dpkg returned an error code (1)
dpkg: error: --purge needs at least one package name argument

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !

请问各位大佬们,我该怎么办

# uname -a
Linux dz6 4.4.0-122-generic #146-Ubuntu SMP Mon Apr 23 15:34:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
# lsb_release -a
LSB Version:    core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID:    Ubuntu
Description:    Ubuntu 18.04 LTS
Release:    18.04
Codename:    bionic
阅读 4k
2 个回答

自己编译安装吧,或者用docker拉个镜像来。以前写的一个shell:LnmpShell

把出错的包卸了重装,autoremve不加包名时只会删除自动选择的没有被依赖的包,不会删除手动安装的包。你需要加上包名。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题