温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

在CentOS / RHEL 6.10上安装PHP的方法

发布时间:2020-08-21 14:36:14 来源:亿速云 阅读:131 作者:小新 栏目:编程语言

这篇文章主要介绍在CentOS / RHEL 6.10上安装PHP的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

 PHP 7.3是PHP最新的稳定版本。本文将给大家介绍如何在CentOS和Redhat 6.10系统上安装PHP 7.3、PHP 7.2、PHP 7.1。

配置yum库

首先,需要在系统上启用Remi和EPEL yum存储库。使用以下命令在CentOS和Red Hat 7/6系统上安装EPEL存储库

使用此命令安装epel-release yum存储库

# yum install epel-release

现在根据你的操作系统版本执行以下命令之一来安装Remi 存储库。

$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

在CentOS 6上安装PHP 7

你的系统已经为从yum存储库安装PHP做好了准备。根据需要,使用以下命令之一在系统上安装PHP 7.3或PHP 7.2或PHP 7.1。

## 安装PHP 7.3 
$ yum --enablerepo=remi-php73 install php

## 安装PHP 7.2 
$ yum --enablerepo=remi-php72 install php

## 安装PHP 7.1 
$ yum --enablerepo=remi-php71 install php

我已经在我的系统上安装了最新版本的PHP 7.3。现在运行以下命令来检查系统的当前使用的PHP版本。

$ php -v

PHP 7.3.0 (cli) (built: Dec  4 2018 16:12:20) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies

安装PHP模块

你还可能需要根据你的应用程序需求安装额外的PHP模块。

下面的命令将安装一些有用的PHP模块。

### For PHP 7.3
$ yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

### For PHP 7.2
$ yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

### For PHP 7.1
$ yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

你可以运行以下命令,在已配置的yum存储库下搜索其他可用的PHP模块。

下面的示例命令搜索PHP 7.3的所有模块。

$ yum --enablerepo=remi-php73 search php | grep php73

php73.x86_64 : Package that installs PHP 7.3
php73-php.x86_64 : PHP scripting language for creating dynamic web sites
php73-php-bcmath.x86_64 : A module for PHP applications for using the bcmath
php73-php-brotli.x86_64 : Brotli Extension for PHP
php73-php-cli.x86_64 : Command-line interface for PHP
php73-php-common.x86_64 : Common files for PHP

以上是在CentOS / RHEL 6.10上安装PHP的方法的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI