1. 程式人生 > >centos/RHEL 7.6 使用yum安裝php7.3(方便wordpress的php7.3需求,並解決了libphp7.so缺失問題)

centos/RHEL 7.6 使用yum安裝php7.3(方便wordpress的php7.3需求,並解決了libphp7.so缺失問題)

rap using ger eating rem install 通過 https database

我最近想安裝一個wordpress, 但是官網介紹需要php7.3以上版本,但是百度了一下,都是要編譯安裝。

為此,我想,centos..., php... 兩大當紅辣子雞沒有yum安裝方式,簡直不可能。

為此,我搜尋了各種源,發現remi源有php73。

但是我yum install 以後,發現兩個致命的問題:

(1)php -v 不會顯示任何東西,要php73 -v 才行

(2)建立一個phpinfo的測試頁,沒有任何反應,據研究是apache缺乏libphp7.so模塊,各種教程都讓我編譯的時候加一個參數,但我是yum安裝的啊。

於是乎,我找到了一個外國教程,安裝後完美解決上述問題。

開題聲明:翻譯自:https://tecadmin.net/install-php7-on-centos7/

《如何將PHP7.3,7.2, 7.1 安裝在centos/RHEL 7.6 上?》

  PHP7.3是PHP最新的穩定發行版,很多流行的yum倉庫都提供php7的rpm安裝包,這篇文章用Remi和EPEL倉庫將安裝包安裝至你的系統。這篇文章幫你將PHP7.3, 7.2, 7.1服務安裝至你的系統,這篇教程經過了centos7.4.1708的測試(實際上譯者用7.6也可用)。

設置你的yum倉庫

  首先,你需要安裝remi和EPEL倉庫,使用下面的命令安裝:

安裝EPEL:

sudo yum install epel-release

安裝remi:

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

  

安裝PHP7

(譯者:根據需求選擇一個指令即可)

## 安裝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 

我安裝了php7.3, 通過下面指令檢測是否正確運行:

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模塊,下面是一些有用的模塊的安裝指令。(譯者:如果你不安裝,就會缺這缺那,比方說libphp7.so)

### 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

  你也可以通過下面的指令搜尋一些其它php模塊,下面的示例指令將列出remi倉庫下所有PHP7.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
...
...

  

結尾再次聲明,翻譯自:https://tecadmin.net/install-php7-on-centos7/

centos/RHEL 7.6 使用yum安裝php7.3(方便wordpress的php7.3需求,並解決了libphp7.so缺失問題)