To install php 7.x we need to install a few things first
sudo yum -y install epel-release |
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm |
sudo yum -y install yum-utils |
Now enable the version of php 7 you wish you install
sudo yum-config-manager –enable remi-php72
Note: if you want to install php 7.0 or 7.1 you can use the command below.
yum-config-manager –enable remi-php70
yum-config-manager –enable remi-php71
You see 72 stands for 7.2, 70 stands for version 7.0 and 71 stands for 7.1
Finally its time to install PHP 7.2
sudo yum -y install php
Add (MySQL/MariaDB) database support to php
sudo yum -y install php-mysqlnd
Don’t forget to restart the server after php installation for the changes to take effect.
sudo service httpd restart
or
sudo systemctl restart httpd.service
Congrats you have now successfully install PHP 7.x in your server.
To check php version
php -v
To activate apache2
sudo systemctl apache2 restart
sudo systemctl status apche2