Michael O.
2min Read

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

Install or Upgrade to Php 7

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. Download our Linux commands cheat sheet now.

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, the sudo command is required.

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 us today. We provide and manage a range of server hosting solutions for all your needs.


The Author

Michael O.

Michael is the founder, managing director, and CEO of HOSTAFRICA. He studied at Friedrich Schiller University Jena and was inspired by Cape Town's beauty to bring his German expertise to Africa. Before HOSTAFRICA, Michael was the Managing Director of Deutsche Börse Cloud Exchange AG, one of Germany's largest virtual server providers.

More posts from Michael