How to install PHP 7 on CentOS 7

PHP is so common that a 78.9% of all websites online to this date are running PHP (according to W3Techs’ data) Why are we here? because CentOS 7 ships with PHP 5.4 by default which is no longer supported as of September of '05 and a bunch of applications do not support it, so we're going to go through the process of installing PHP 7 which is supported by most applications at the time of writing this howto guide.

php7oncentos7on

 

We'll need root or sudo access to get going so make sure you have the required access to the system.

Let's first make sure we're up to date on everything:

sudo yum update; sudo yum upgrade -y

yum-update-upgrade

Then we'll enable the Remi repository, which is a free repository providing many cutting edge latest versions of software which are not available in your CentOS installation and or repository by default; Remi relies on epel-release so if you do not have it installed we'll start there:

sudo yum install epel-release yum-utils -y

 

yuminstallepelyumutils

 

Then we're going to install the remi repo by executing the following command:

sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y

 


remiinstallcentos7

Then we'll install PHP 7.3 which at the time of writing this howto guide is the latest version available currently supported by most CMS platforms, for this we'll first enable the remi repo:

sudo yum-config-manager --enable remi-php73

 

enableremirepo

 

Let's now install PHP 7.3 and a bunch of modules:

sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd -y

 

yuminstallphp73

 

Once this process is complete we can now check on the currently installed php version by running the following command:

php -v

 

php-v

 

That should do, you know have a recent php 7 version on your server.

 

If you're looking for a Cloud VPS, dedicated server or a web hosting service please take a look at our plans here: https://owned-networks.net

 

  • php 7, centos 7
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

ownCloud Auto Install Script on Debian 7

Here is an easy way to install ownCloud on Debian 7 with a script, but first, for those who...

NGINX – Allow access only to certain IPs

Nginx has a nice module that not many people know about, it basically enables us...

How to configure NTP client in CentOS

What's NTP? NTP stands for Network Time Protocol, and it is an Internet protocol used to...

Initial Server Setup on CentOS 6

Here are some recommendations to setup your VPS or server when you first get it, some of these...

How To Install nginx on CentOS

What is NGINX? Nginx (pronounced "engine-x") is an open source reverse proxy server for HTTP,...