如何在CentOS / RHEL 6.10上安裝PHP( 7.3,7.2,7.1)?

2019-11-01     科技i關注

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

...

...

相關推薦:《PHP教程》

本篇文章就是關於在CentOS / RHEL 6.10上安裝PHP( 7.3,7.2,7.1)的方法步驟介紹,希望對需要的朋友有所幫助!

以上就是如何在CentOS / RHEL 6.10上安裝PHP( 7.3,7.2,7.1)?的詳細內容,更多請關注其它相關文章!

更多技巧請《轉發 + 關注》哦!

文章來源: https://twgreatdaily.com/zh-tw/xzBpI24BMH2_cNUgolPe.html