无法摆脱阻止安装 php8.0 的 php7.2

发布于 2025-01-16 19:57:17 字数 877 浏览 2 评论 0原文

我面临着摆脱 php7.2.2 为我的机器上的 php8.0 铺平道路的挑战。我尝试了许多建议的解决方案,但仍然不明白为什么当我运行 php7.2.2 时仍然显示 php -v ,但在尝试清除特定的 php 版本时,找不到它。我什至尝试重新启动我的电脑,看看更改是否有效,但没有。请参阅下面所附的屏幕截图。

截图中所示的命令

首先,我开始尝试使用以下命令删除 php7.2.2:- sudo apt-get --purge auto-remove php7.2.2

二、交互切换模式

sudo update-alternatives --config php sudo update-alternatives --config phar sudo update-alternatives --config phar.phar

第三,我尝试了手动切换 从 PHP 7.2 开始 => PHP 8.0

系统上默认设置了 PHP 7.2,我不得不切换到 PHP 8.0。 阿帕奇:

$ sudo a2dismod php7.2 $ sudo a2enmod php8.0 $ sudo service apache2 restart

也尝试过,命令行:

$ sudo update-alternatives --set php /usr/bin/php8.0 $ sudo update-alternatives --set phar /usr/bin/phar8.0 $ sudo update-alternatives --set phar.phar /usr/bin/phar.phar8.0

I have a challenge in getting rid of php7.2.2 to pave way for php8.0 on my machine. I have tried to with a number of suggested solutions but still don't understand why php7.2.2 still shows up when i run php -v yet on trying to purge that specific php version the, it's not found. I have even tried to restart my pc to see if the changes would be effective but not. Please see the screenshot attached below.

commands illustrated in the screenshot

First, I started By trying to remove php7.2.2 using the following commands:-
sudo apt-get --purge auto-remove php7.2.2

Second, Interactive switching mode

sudo update-alternatives --config php
sudo update-alternatives --config phar
sudo update-alternatives --config phar.phar

Third, I tried Manual Switching
From PHP 7.2 => PHP 8.0

Default PHP 7.2 is set on the system and I had to switch to PHP 8.0.
Apache:

$ sudo a2dismod php7.2
$ sudo a2enmod php8.0
$ sudo service apache2 restart

Have also tried, Command Line:

$ sudo update-alternatives --set php /usr/bin/php8.0
$ sudo update-alternatives --set phar /usr/bin/phar8.0
$ sudo update-alternatives --set phar.phar /usr/bin/phar.phar8.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文