Install PHP 7.1 on CentOS, RHEL or Fedora
+
Par Remi le lundi 5 décembre 2016, 11:20 - HowTo - Lien permanent
Here is a quick howto upgrade default PHP version provided on Fedora, RHEL or CentOS with latest version 7.1.
Repositories configuration:
On Fedora, standards repositories are enough, on Enterprise Linux (RHEL, CentOS) the Extra Packages for Enterprise Linux (EPEL) repository must be configured, and on RHEL the optional channel must be enabled.
Fedora 25
wget http://rpms.remirepo.net/fedora/remi-release-25.rpm dnf install remi-release-25.rpm
Fedora 24
wget http://rpms.remirepo.net/fedora/remi-release-24.rpm dnf install remi-release-24.rpm
RHEL version 7.2 or 7.3
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm subscription-manager repos --enable=rhel-7-server-optional-rpms
RHEL version 6.8
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm rhn-channel --add --channel=rhel-$(uname -i)-server-optional-6
CentOS version 7.2 (or 7.3)
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
CentOS version 6.8
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
remi-php71 repository activation
Needed packages are in the remi-safe (enabled by default) and remi-php71 repositories, the latest is not enabled by default (administrator choice according to the desired PHP version).
RHEL or CentOS
yum install yum-utils yum-config-manager --enable remi-php71
Fedora
dnf install dnf-plugins-core dnf config-manager --set-enabled remi-php71
PHP upgrade
By choice, the packages have the same name than in the distribution, so a simple update is enough:
yum update
That's all :)
$ php -v PHP 7.1.0 (cli) (built: Dec 1 2016 06:23:20) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.1.0, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans
Known issues
The upgrade can fail (by design) when some installed extensions are not yet compatible with PHP 7.
See the compatibility tracking list: PECL extensions RPM status
If these extensions are not mandatory, you can remove them before the upgrade, else, you will have to be patient.
Warning: some extensions are still under development (memcache, redis...), but it seems useful to provide them to allow upgrade to more people, and to allow user to give feedback to the authors.
More d'information
If you prefer to install PHP 7 beside PHP 5, this can be achieve using the php71 prefixed packages, see the PHP 7.1 as Software Collection post.
You can also try the configuration wizard.
The packages available in the repository will be used as source for Fedora 26 (self contained change proposal already accepted).
By providing a full feature PHP stack, with about 150 available extensions, 4 PHP versions, as base and SCL packages, for Fedora and Enterprise Linux, and with 100 000 download per day, remi repository became in the last 10 years a reference for PHP users on RPM based distributions, maintained by an active contributor to the projects (Fedora, PHP, PECL...).
See also:
- Posts RSS feed (versions announcements)
- Comments RSS feed
- Repository RSS feed (example for EL-7, php 7.1)
Commentaires
Also read: Install PHP 7.2 on CentOS, RHEL or Fedora