php7.3是php的最新穩(wěn)定版本,yum存儲庫正在為php7提供RPM包。本篇文章將使用remi和epel-yum存儲庫在你的系統(tǒng)上安裝所需的軟件包,將介紹在CentOS和Redhat7服務器上安裝php 7.3、php 7.2、php 7.1。
設置yum存儲庫
首先,需要在系統(tǒng)上啟用Remi和EPEL yum存儲庫。使用以下命令在CentOS和Red Hat 7/6系統(tǒng)上安裝EPEL存儲庫
使用此命令在系統(tǒng)上安裝EPEL yum存儲庫
$ sudo yum install epel-release
現(xiàn)在根據(jù)你的操作系統(tǒng)版本執(zhí)行以下命令之一以安裝REMI存儲庫。
$ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
在CentOS上安裝php 7
你的系統(tǒng)已準備好從yum存儲庫安裝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
假設已經(jīng)在系統(tǒng)上安裝了最新版本的php 7.3?,F(xiàn)在運行下面的命令來檢查系統(tǒng)上當前運行的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ù)應用程序需求安裝其他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
- 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
- ...
- ...
新聞熱點
疑難解答
圖片精選