删除了 /usr/bin/php

删除了 /usr/bin/php

我在实时网络服务器上犯了一个愚蠢的错误,需要一些帮助来恢复。

以 root 身份登录时(错误 #1),我使用 wget 将文件复制到 /usr/bin/php,创建了目录 /usr/bin/php,其中有一个文件(错误 #2)。虽然我有系统备份,但其中没有任何内容可以显示以前的内容,我真的不想进行完整的系统恢复或重建。

php cli 现在无法工作(也许其他东西也一样?)尽管软件包列表显示它仍然安装。幸运的是,网站仍在运行,但 ispconfig3 控制面板变得不稳定,因为它依赖于使用 php 的 .sh 文件。

有没有什么办法可以恢复,而不使事情变得更糟?

root@VPS:# ls -al /usr/bin/php
ls: cannot access '/usr/bin/php': No such file or directory

root@VPS:# php

Command 'php' not found, but can be installed with:

apt install php7.2-cli
apt install hhvm
root@VPS:# apt list --installed | grep php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libapache2-mod-php/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
libapache2-mod-php7.2/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php-apcu/bionic,now 5.1.9+4.0.11-1build1 amd64 [installed]
php-apcu-bc/bionic,now 1.0.3-2ubuntu2 amd64 [installed,automatic]
php-auth-sasl/bionic,bionic,now 1.0.6-3 all [installed,automatic]
php-bz2/bionic,bionic,now 1:7.2+60ubuntu1 all [installed,automatic]
php-common/bionic,bionic,now 1:60ubuntu1 all [installed,automatic]
php-gettext/bionic,bionic,now 1.0.12-0.1 all [installed]
php-imagick/bionic,now 3.4.3~rc2-2ubuntu4 amd64 [installed,upgradable to: 3.4.3~rc2-2ubuntu4.1]
php-mail-mime/bionic,bionic,now 1.10.2-0.1 all [installed,automatic]
php-memcache/bionic,now 3.0.9~20160311.4991c2f-5build2 amd64 [installed]
php-net-sieve/bionic,bionic,now 1.4.1-1 all [installed]
php-net-smtp/bionic,bionic,now 1.8.0-1 all [installed,automatic]
php-net-socket/bionic,bionic,now 1.0.14-2 all [installed,automatic]
php-pear/now 1:1.10.5+submodules+notgz-1ubuntu1.18.04.1 all [installed,upgradable to: 1:1.10.5+submodules+notgz-1ubuntu1.18.04.2]
php-php-gettext/bionic,bionic,now 1.0.12-0.1 all [installed,automatic]
php-phpseclib/bionic,bionic,now 2.0.9-1 all [installed,automatic]
php-soap/bionic,bionic,now 1:7.2+60ubuntu1 all [installed]
php-tcpdf/bionic,bionic,now 6.2.13+dfsg-1ubuntu1 all [installed,automatic]
php-xml/bionic,bionic,now 1:7.2+60ubuntu1 all [installed,automatic]
php7.2/now 7.2.19-0ubuntu0.18.04.2 all [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-bz2/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-cgi/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-cli/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-common/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-curl/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-fpm/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-gd/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-imap/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-intl/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-json/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-mbstring/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-mysql/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-opcache/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-pspell/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-readline/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-recode/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-soap/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-sqlite3/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-tidy/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-xml/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-xmlrpc/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-xsl/now 7.2.19-0ubuntu0.18.04.2 all [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
php7.2-zip/now 7.2.19-0ubuntu0.18.04.2 amd64 [installed,upgradable to: 7.2.24-0ubuntu0.18.04.7]
phpmyadmin/bionic,bionic,now 4:4.6.6-5 all [installed,upgradable to: 4:4.6.6-5ubuntu0.5]

答案1

sudo rm -Rf /usr/bin/php
sudo apt-get install --reinstall php7.2-cli

首先,我们删除 中的所有内容/usr/bin/php,然后我们告诉apt-get重新安装提供 的 php-cli /usr/bin/php

相关内容