在CentOS和RHEL上安裝PHP7的方法

這篇文章將為大家詳細(xì)講解有關(guān)如何在CentOS和RHEL上安裝PHP7,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比東港網(wǎng)站開(kāi)發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式東港網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋東港地區(qū)。費(fèi)用合理售后完善,10年實(shí)體公司更值得信賴。

php7.3是php的最新穩(wěn)定版本,yum存儲(chǔ)庫(kù)正在為php7提供RPM包。本篇文章將使用remi和epel-yum存儲(chǔ)庫(kù)在你的系統(tǒng)上安裝所需的軟件包,將介紹在CentOS和Redhat7服務(wù)器上安裝php 7.3、php 7.2、php 7.1。

在CentOS和RHEL上安裝PHP7的方法

設(shè)置yum存儲(chǔ)庫(kù)

首先,需要在系統(tǒng)上啟用Remi和EPEL yum存儲(chǔ)庫(kù)。使用以下命令在CentOS和Red Hat 7/6系統(tǒng)上安裝EPEL存儲(chǔ)庫(kù)

使用此命令在系統(tǒng)上安裝EPEL yum存儲(chǔ)庫(kù)

$ sudo yum install epel-release

現(xiàn)在根據(jù)你的操作系統(tǒng)版本執(zhí)行以下命令之一以安裝REMI存儲(chǔ)庫(kù)。

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

在CentOS上安裝php 7

你的系統(tǒng)已準(zhǔn)備好從yum存儲(chǔ)庫(kù)安裝PHP。根據(jù)你的需求,使用以下命令之一在系統(tǒng)上安裝php 7.3、php 7.2或php 7.1。

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

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

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

假設(shè)已經(jīng)在系統(tǒng)上安裝了最新版本的php 7.3。現(xiàn)在運(yùn)行下面的命令來(lái)檢查系統(tǒng)上當(dāng)前運(yùn)行的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模塊

可能還需要根據(jù)應(yīng)用程序需求安裝其他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

可以運(yùn)行以下命令來(lái)搜索配置yum存儲(chǔ)庫(kù)下的其他可用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
php73-php-componere.x86_64 : Composing PHP classes at runtime
php73-php-dba.x86_64 : A database abstraction layer module for PHP applications
php73-php-dbg.x86_64 : The interactive PHP debugger
php73-php-devel.x86_64 : Files needed for building PHP extensions
php73-php-embedded.x86_64 : PHP library for embedding in applications
php73-php-enchant.x86_64 : Enchant spelling extension for PHP applications
php73-php-fpm.x86_64 : PHP FastCGI Process Manager
php73-php-gd.x86_64 : A module for PHP applications for using the gd graphics
...
...

關(guān)于如何在CentOS和RHEL上安裝PHP7就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。

文章題目:在CentOS和RHEL上安裝PHP7的方法
轉(zhuǎn)載來(lái)源:http://bm7419.com/article22/pcgicc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、品牌網(wǎng)站設(shè)計(jì)企業(yè)網(wǎng)站制作、網(wǎng)站收錄響應(yīng)式網(wǎng)站、網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁(yè)設(shè)計(jì)