如何更改Shell上的默认PHP基本版本? [英] How do I change the default PHP base-version on shell?

查看:100
本文介绍了如何更改Shell上的默认PHP基本版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Centos 7和Virtualmin,并使用了Tipycal php-fpm 5.4、7.0、7.1,您可以通过Virtualmin控制面板在每个虚拟主机上选择所需的版本,并且一切正常.

I have Centos 7 and Virtualmin installed, with the tipycal php-fpm 5.4, 7.0, 7.1 that you can choice between the versions you prefer on every virtualhost via Virtualmin control panel, and everything works well.

但是当我通过SSH访问服务器并检查 php -v 时,我得到了:

But when I access to the server via SSH and check php -v I get this:

PHP 5.4.16(cli)(内置:2018年10月30日19:30:51)版权所有(c)1997-2013 The PHP GroupZend Engine v2.4.0,版权所有(c)1998-2013 Zend Technologies

如何为Shell系统选择另一个php默认/基本版本?

How can I select another php default/base version for the shell system?

推荐答案


在centos 7中安装PHP版本


设置百胜仓库首先,您需要在系统上启用Remi和EPEL yum存储库.使用以下命令在您的CentOS和Red Hat 7/6系统上安装EPEL存储库


Install versions of PHP in centos 7


Setup Yum Repository First of all, you need to enable Remi and EPEL yum repositories on your system. Use the following command to install EPEL repository on your CentOS and Red Hat 7/6 systems

使用此命令在系统上安装EPEL yum存储库

Use this command to install EPEL yum repository on your system

 sudo yum install epel-release

,然后根据您的操作系统版本执行以下命令之一,以安装Remi存储库.

and now execute one of the following commands as per your operating system version to install the Remi repository.

sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

在CentOS上安装PHP 7您的系统已准备好从yum存储库安装PHP.根据需要,使用以下命令之一在系统上安装PHP 7.4或PHP 7.3或PHP 7.2或PHP 7.1.

Install PHP 7 on CentOS Your system is prepared for the PHP installation from yum repositories. Use one of the following commands to install PHP 7.4 or PHP 7.3 or PHP 7.2 or PHP 7.1 on your system based on your requirements.

yum --enablerepo=remi-php74 install php

安装PHP 7.3

yum --enablerepo=remi-php73 install php

安装PHP 7.2

yum --enablerepo=remi-php72 install php

.检查版本PHP安装

php -v

.

PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

安装PHP模块您可能还需要根据您的应用程序要求安装其他PHP模块.下面的命令将安装一些更有用的PHP模块.

Install PHP Modules You may also need to install additional PHP modules based on your application requirements. The below command will install some more useful PHP modules.

yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

对于PHP 7.3

yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

对于PHP 7.2

yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

这篇关于如何更改Shell上的默认PHP基本版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆