PHP
| |

How to? Install PHP version 7.4, 7.3, 7.2 & 7.1 on Cent OS7

PHP is the most important part of LAMP. By default, PHP version 5.4 is available in CentOS 7 repositories.

Steps to install PHP 7.1, 7.2, 7.3 & 7.4 on CentOS 7

Connect using putty to log in to Server and use below command to install epel and utils repositories

yum install epel-release yum-utils -y

Now download and install remirepo repository using the following command

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

Once installation is complete based on requirement configure the required PHP version 7.x

To configure PHP version 7.1, use following command,

yum-config-manager --enable remi-php71

To configure PHP version 7.2, use following command,

yum-config-manager --enable remi-php72

To configure PHP version 7.3, use following command,

yum-config-manager --enable remi-php73

To configure PHP version 7.4, use following command,

yum-config-manager --enable remi-php74

The version whichever is required has been installed and enabled, To further add dependencies for required version use the following command

yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y

To search for all available modules in PHP, run the following command

yum search php | more

This will come handy when modules are required based on project.

Now check the version of PHP that we have installed. using the below command

php -v

Restart apache to reflect the changes

systemctl restart httpd

Now go to your IP / domain and check the php info page, It should show as below,

Similar Posts