如何从我的 Ubuntu 18 服务器中删除 php7.1?

如何从我的 Ubuntu 18 服务器中删除 php7.1?

我尝试过这个:

➜  /etc dpkg -l |grep php
rc  php7.1-cli                        7.1.17-1+ubuntu17.10.1+deb.sury.org+1   amd64        command-line interpreter for the PHP scripting language
rc  php7.1-fpm                            7.1.17-1+ubuntu17.10.1+deb.sury.org+1   amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
rc  php7.1-json                           7.1.17-1+ubuntu17.10.1+deb.sury.org+1   amd64        JSON module for PHP
rc  php7.1-mysql                          7.1.17-1+ubuntu17.10.1+deb.sury.org+1   amd64        MySQL module for PHP
rc  php7.1-opcache                        7.1.17-1+ubuntu17.10.1+deb.sury.org+1   amd64        Zend OpCache module for PHP
rc  php7.1-readline                       7.1.17-1+ubuntu17.10.1+deb.sury.org+1   amd64        readline module for PHP
rc  phpmyadmin                            4:4.6.6-5                               all          MySQL web administration tool

然后我尝试了这个:

➜  /etc apt remove php7.1-cli php7.1-fpm php7.1-json php7.1-mysql php7.1-opache php7.1-readline phpmyadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.1-opache
E: Couldn't find any package by glob 'php7.1-opache'
E: Couldn't find any package by regex 'php7.1-opache'

我怎样才能除去剩余的?

编辑:抱歉打错了,但我已更正并再次运行。这是我得到的结果:

➜  /etc apt remove php7.1-cli php7.1-fpm php7.1-json php7.1-mysql php7.1-opcache php7.1-readline phpmyadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'phpmyadmin' is not installed, so not removed
Package 'php7.1-readline' is not installed, so not removed
Package 'php7.1-mysql' is not installed, so not removed
Package 'php7.1-fpm' is not installed, so not removed
Package 'php7.1-cli' is not installed, so not removed
Package 'php7.1-json' is not installed, so not removed
Package 'php7.1-opcache' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

总结:您要删除的软件包已被删除(或从未安装过)。

解释

如果您查看输出开头的列标题dpkg -l(见下文),您会看到rc是所需和实际包状态的简写。这些简写的解释也包含在列标题中:r移動Conf-文件

不幸的是,标题被 隐藏了grep,但您可以使用dpkg -l '*php*'来实现大致相同的效果。作为奖励,列被缩写,以允许表格适合您当前终端的宽度(无需输出重定向)。

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                   Version          Architecture     Description
+++-======================-================-================-=================================================
[...]

答案2

你的系统上仍有配置文件。你可以使用以下命令清除软件包

sudo apt purge php7.1-cli ...

然后它们就会从 dpkg -l 中消失

相关内容