Keith • 17 Oct 2018

How to Install or Upgrade to Php 7 On Centos 7 Linux

How to Install or Upgrade to Php 7 On Centos 7 Linux

To install or upgrade to PHP 7 on CentOS 7 Linux server is a fairly simple process when you use Remi Repository. Upgrading from PHP 5 to PHP 7 is recommended for Linux servers running CentOS 7. To be able to install or upgrade to PHP 7, you will need privileged access to your CentOS Linux system. If you are a root user this will give you direct access, but if not, sudo command is required. Don’t forget to download or handy Linux commands cheat sheet.

Instructions to install or upgrade to PHP 7 on CentOS 7 Linux server

Whether you currently have PHP 5 installed on your system or you want to perform a new PHP installation, these instructions to install or upgrade to PHP 7 on CentOS 7 Linux will apply to both.

  1. The first step is to check your current PHP version if applicable. Run the command # php –version to see your current version.
  2. Download Remi and EPEL Repository packages. Run the commands:
    $ 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
  3. Install both these 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
    The current latest PHP version from Remi Repository is 7.1. For any subsequent PHP releases, simply amend the above command accordingly.
  4. Install or upgrade to PHP with the command: # yum install php
    Alternatively, you can upgrade the entire system with # yum update

Let HOSTAFRICA assist with all your server needs

The final step is to check your current PHP version again to ensure that the install or upgrade to PHP 7 on CentOS 7 Linux server was performed correctly. Running the command # php –version again should result in the PHP 7 version that you just installed. If you need any assistance with this guide on how to install or upgrade to PHP 7 on CentOS 7 Linux server, feel free to contact HOSTAFRICA today. We provide and manage a range of server hosting solutions for all your needs.

Ashwin S.

The Author

Ashwin is a content specialist at HOSTAFRICA, where he's been crafting clear, authoritative copy since 2021. With a background in digital marketing and a passion for impactful storytelling, he turns complex ideas into trustworthy, engaging content. Ashwin writing helps our audience navigate web hosting and cloud solutions with confidence.

Related posts

Stay Ahead of the Curve: Why Updating Your PHP Version is Essential

Ashwin S. • 17 Nov 2023 • min

Stay Ahead of the Curve: Why Updating Your PHP Version is Essential
How To Change PHP Versions/Extensions for all users | PHP Selector’s Useful Commands

Joel Lumumba • 30 Sep 2022 • min

How To Change PHP Versions/Extensions for all users | PHP Selector’s Useful Commands

Need Assistance?

Our local Ghanaian support team
is ready to help.

assistants