Base repository of CentOS has no php7 packages.
You can use remi repo to install php7 on your CentOS 7.
Why Remi?
- PHP package installed from remi repo will work as drop-in replacement for your current php5 binaries.
- Remi repo is managed by one of PHP internals
- Why not?
To install the Remi repository, we need to enable the EPEL repository first.
sudo yum install epel-release yum-utils
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Then Enable php 7.0 (You can use php 7.1+ too)
sudo yum-config-manager --enable remi-php70
Now it’s time to install php7
yum install php php-common php-cli php-mysql
Great!!!
Now you have php7 on your system. You can confirm with :
php -v
Source: https://stackoverflow.com/questions/51006367/update-php-from-5-5-7-to-7-on-centos7/51006990#51006990