5%

Become a Vendor

COMMISSION

Developer for

Siberian&Nwicode

How to install or upgrade to PHP 7 on CentOS 7 Linux Server

Objective

The objective is to install or replace existing PHP 5 with PHP 7 on CentOS 7 Linux server. As you will see, this procedure is fairly simple when using Remi Repository.

Requirements

Privileged access to your CentOS Linux system either directly as root user or via sudo command is required.

Difficulty

EASY

Conventions

  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user

Instructions

The following guide will either upgrade your current PHP 5 to PHP 7 or will install new PHP 7 on your CentOS system. Check your current PHP version ( if applicable ):

# php --version
PHP 5.4.16 (cli) (built: Nov  6 2016 00:29:02) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Download Remi and EPEL Repository packages

First, download Remi and EPEL Repository packages:

$ wget -q http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ wget -q https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Enable Remi and EPEL Repository

Install both previously downloaded packages and enable Remi PHP 7 repo:

# rpm -i remi-release-7.rpm epel-release-latest-7.noarch.rpm
FOR PHP 7.0 EXECUTE:
# yum-config-manager --enable remi-php70
FOR PHP 7.1 EXECUTE:
# yum-config-manager --enable remi-php71
FOR PHP 7.2 EXECUTE:
# yum-config-manager --enable remi-php72
FOR PHP 7.3 EXECUTE: 
# yum-config-manager --enable remi-php73
FOR PHP 7.4 EXECUTE: 
# yum-config-manager --enable remi-php74

Current latest PHP version from Remi repository is 7.1. Amend the above command for any other subsequent PHP releases.

Install or Upgrade to PHP 7

Whether you already have PHP 5 installed on your system or you are performing a new PHP 7 installation, the below command will cater for both:

# yum install php

Alternatively, upgrade entire system with yum update command:

# yum update

Check your current PHP version

# php --version
PHP 7.1.0 (cli) (built: Dec  1 2016 08:13:15) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Appteam to offer you a better experience on this site uses its own and third-party technical, analytical and profiling cookies. The site also uses third-party tracking cookies to adapt advertising to your preferences.

If you want to know more or refuse consent to the use of cookies click here. By continuing to browse, you consent to the use of cookies.

Privacy Settings saved!
GDPR Center

When you visit a website, it can store or retrieve information on your browser, mainly in the form of cookies. Check your personal cookie services here.

These cookies are necessary for the website to function and cannot be disabled in our systems.

In order to use this website we use the following technically required cookies
  • wordpress_logged_in_
  • wordpress_sec
  • wordpress_test_cookie

We use WooCommerce as a purchasing system. 2 cookies will be stored for the shopping cart and order processing. These cookies are strictly necessary and cannot be disabled.
  • woocommerce_cart_hash
  • woocommerce_items_in_cart

  • wordpress_test_cookie
  • wordpress_logged_in_
  • wordpress_sec

Decline all Services
Accept all Services

Main Menu