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, 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.
- The first step is to check your current PHP version if applicable. Run the command # php –version to see your current version.
- 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
- Install both these downloaded packages and enable Remi PHP 7 repo:
# rpm -i remi-release-7.rpm epel-release-latest-7.noarch.rpmFor PHP 7.0, execute:
# yum-config-manager --enable remi-php70For PHP 7.1, execute:
# yum-config-manager --enable remi-php71For PHP 7.2, execute:
# yum-config-manager --enable remi-php72The current latest PHP version from Remi Repository is 7.1. For any subsequent PHP releases, simply amend the above command accordingly.
- Install or upgrade to PHP with the command:
# yum install phpAlternatively, 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.