How to Install PHP 7.x on CentOS 7
Setup the follwing YUM repo
Setup the Remi and EPEL yum repositories on your system.:
yum install epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
The above commands install the EPEL Repository and REMI repository which contains the PHP packages listed below,
Install PHP 7.1 with PHP Modules
To Install PHP 7.1, run the following command:
yum --enablerepo=remi-php71 install php php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
Install PHP 7.2 with PHP Modules
To Install PHP 7.2, run the following command:
yum --enablerepo=remi-php72 install php php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
Install PHP 7.3 with PHP Modules
To Install PHP 7.3, run the following command:
yum --enablerepo=remi-php73 install php php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
Install PHP 7.4 with PHP Modules
To Install PHP 7.4, run the following command:
yum --enablerepo=remi-php74 install php php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
Post Installation steps
Once you install the PHP version required, you would need to restart your web-server, in our example, we use Apache, so simply run,
If on Debian/Ubuntu,
service apache2 restart
or, if on CentOS,
service httpd restart
and done!
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS