php 7.2 未安装但显示在 php -v
Posted
技术标签:
【中文标题】php 7.2 未安装但显示在 php -v【英文标题】:php 7.2 not isntalled but showed on php -v 【发布时间】:2020-03-11 14:34:36 【问题描述】:我在我的树莓派上安装了 php 7.3。当我在浏览器中使用 phpinfo() 时,它确实显示 PHP 7.3。
但是当我在终端中使用 php -v 尝试它时,它显示 PHP 7.2.24
我搜索了 PHP 7.2 的安装,但没有。
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libapache2-mod-php7.0/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
libapache2-mod-php7.3/stable,now 7.3.11-1~deb10u1 armhf [installed]
php/oldstable,now 1:7.0+49 all [installed]
php-bz2/oldstable,now 1:7.0+49 all [installed,automatic]
php-common/oldstable,now 1:49 all [installed,automatic]
php-curl/stable,now 2:7.3+69 all [installed,automatic]
php-gd/oldstable,now 1:7.0+49 all [installed,automatic]
php-mbstring/oldstable,now 1:7.0+49 all [installed,automatic]
php-mysql/oldstable,now 1:7.0+49 all [installed,automatic]
php-pear/oldstable,now 1:1.10.1+submodules+notgz-9+deb9u1 all [installed,automatic]
php-php-gettext/oldstable,stable,now 1.0.12-0.1 all [installed,automatic]
php-phpseclib/oldstable,now 2.0.4-1 all [installed,automatic]
php-tcpdf/oldstable,now 6.2.12+dfsg2-1 all [installed,automatic]
php-xml/oldstable,now 1:7.0+49 all [installed,automatic]
php-zip/oldstable,now 1:7.0+49 all [installed,automatic]
php7.0/oldstable,now 7.0.33-0+deb9u6 all [installed,automatic]
php7.0-bz2/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-cli/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-common/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-gd/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-json/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-mbstring/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-mysql/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-opcache/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-readline/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-xml/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.0-zip/oldstable,now 7.0.33-0+deb9u6 armhf [installed,automatic]
php7.3/stable,now 7.3.11-1~deb10u1 all [installed]
php7.3-cli/stable,now 7.3.11-1~deb10u1 armhf [installed]
php7.3-common/stable,now 7.3.11-1~deb10u1 armhf [installed,automatic]
php7.3-curl/stable,now 7.3.11-1~deb10u1 armhf [installed]
php7.3-fpm/stable,now 7.3.11-1~deb10u1 armhf [installed]
php7.3-gd/stable,now 7.3.11-1~deb10u1 armhf [installed]
php7.3-json/stable,now 7.3.11-1~deb10u1 armhf [installed,automatic]
php7.3-mbstring/stable,now 7.3.11-1~deb10u1 armhf [installed]
php7.3-opcache/stable,now 7.3.11-1~deb10u1 armhf [installed]
php7.3-readline/stable,now 7.3.11-1~deb10u1 armhf [installed,automatic]
php7.3-xml/stable,now 7.3.11-1~deb10u1 armhf [installed]
php7.3-zip/stable,now 7.3.11-1~deb10u1 armhf [installed]
phpmyadmin/oldstable,now 4:4.6.6-4 all [installed]
通过搜索find / -name "*7.2*"
我也没有找到任何东西..
怎么说 php -v 必须用 7.3 代替?
【问题讨论】:
【参考方案1】:检查是否可以执行php7.3
?
有可能php
基本上指向的是旧版本。
【讨论】:
【参考方案2】:我通过重新安装 apache 解决了这个问题。
【讨论】:
【参考方案3】:sudo update-alternatives --set php /usr/bin/php7.3
sudo apt-get purge php7.2-common
【讨论】:
以上是关于php 7.2 未安装但显示在 php -v的主要内容,如果未能解决你的问题,请参考以下文章
启用 Mcrypt 的 PHP 7.2 上的 Laravel 4.2 仍然显示“需要 Mcrypt PHP 扩展”。在浏览器上
列未显示在 PHP 查询中,但显示在 MariaDB 的 phpmyadmin 界面中