How to install PHP 7 on CentOS 7.3

CentOS Tutorial – This tutorial is going to show you how to install PHP 7 on CentOS 7.3. If you are planning to install Owncloud 10 on CentOS 7.3 Server, you will need to install or upgrade your PHP version. Owncloud 10 does not support PHP version 5.4.16. Minimum PHP version required by Owncloud is PHP version 5.4.16. In order to install PHP 7 on CentOS 7.3, we need to do some things.

Steps to install PHP 7 on CentOS 7.3

Step 1. Remove any previous PHP

First we need to remove PHP installed on CentOS. If you haven’t installed PHP, you can skip this step.

yum remove php

Step 2. Add EPEL and REMI Repository

Now we need to add or install EPEL and REMI Repository on CentOS 7.3.

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://mirrors.mediatemple.net/remi/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm

You may need to install wget first if you don’t have it yet.

yum install wget

Now we need to enable REMI repository

nano /etc/yum.repos.d/remi-php71.repo

Now change to Enabled=1

[remi-php71]
name=Remi's PHP 7.1 RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/php71/$basearch/
#mirrorlist=https://rpms.remirepo.net/enterprise/7/php71/httpsmirror
mirrorlist=http://rpms.remirepo.net/enterprise/7/php71/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php71-debuginfo]
name=Remi's PHP 7.1 RPM repository for Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/7/debug-php71/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Step 3. Install PHP 7

Now we can start installing PHP.

yum install php

Once finished, you can check the php version with this command

php --version

Output:

[root@localhost conf.d]# php --version
PHP 7.1.8 (cli) (built: Aug  2 2017 12:13:05) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

Ok that’s it. Thanks for reading this post on how to install PHP 7 on CentOS 7.3 server. Stay tuned for the next tutorial like this.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.