gpt4 book ai didi

php - 如何解决在 ubuntu 21.04 中安装后找不到命令 php?

转载 作者:行者123 更新时间:2023-12-04 07:13:15 28 4
gpt4 key购买 nike

我想安装特定版本的 php,为此我写了这个命令 sudo apt-get install php7.2它是这样显示的

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php7.2-common' for regex 'php7.2'
Note, selecting 'php7.2-sodium' for regex 'php7.2'
Note, selecting 'libapache2-mod-php7.2' for regex 'php7.2'
Note, selecting 'php7.2-thrift' for regex 'php7.2'
0 upgraded, 0 newly installed, 0 to remove and 235 not upgraded.
在此之后,当我想知道 php 的版本时,我运行 php -v我收到以下错误 Command 'php' not found, but can be installed with: sudo apt install php7.4-cli # version 7.4.16-1ubuntu2.1, or sudo apt install php-cli # version 2:7.4+76ubuntu1

最佳答案

运行以下命令它将起作用

sudo apt update
sudo apt upgrade

sudo apt install ca-certificates apt-transport-https

wget -q https://packages.sury.org/php/apt.gpg -- I sudo apt-key add echo "deb https://packages.sury.org/php/stretch

main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update

sudo apt install php7.2

关于php - 如何解决在 ubuntu 21.04 中安装后找不到命令 php?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68938655/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com