This is a step-by-step guide to follow when installing PHP PHP 7.2, 7.3, and 7.4 on RHEL 7 & CentOS Linux system. these are the stable versions that can be used by developers as well as public users. This guide is using Remi and EPEL yum repositories for us to get the needed packages on the system, for our tutorial we have tested using CentOS Linux release 7.4.1708.
1. Enable REMI and YUM Repositories on Linux System
To install EPEL and REMI Repository on your system this is the command used:-
$:-
sudo yum install EPEL-release
$:-sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
2.Install PHP 7.4 on CentOS 7
Once the command to install the repository is completed, Enable PHP 7.2, 7.3, and 7.4 on RHEL 7 & CentOS using the commands listed below
Install PHP 7.4
$:-yum --enablerepo=remi-php74 install php
Install PHP 7.3
$:-yum --enablerepo=remi-php73 install php
Install PHP 7.2
$:-yum --enablerepo=remi-php72 install php
Install PHP 7.1
$:-yum --enablerepo=remi-php71 install php
For our tutorial, we have installed PHP version 7.4 so to check if the installation was successful run the below command and the results are shown below:-
$:- php -v
PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
The installation is successful and we can now proceed to install the PHP Modules based on the requirements required by the application we will be running. Here is the command to install those modules, You will choose based on the version of PHP you Installed into your system.
PHP 7.4
$:-yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
PHP 7.3
$:-yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
PHP 7.2
$:-yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
PHP 7.1
$:-yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
Installation is complete you can now enjoy running PHP on your machine but you have to restart first using the command below
$:-systemctl restart httpd
How to Install Xampp in Linux
Leave a Reply