logo
. . .

How to Install php 7.4 in centos 7

To install PHP 7.4 on CentOS 7, you can use the Remi repository, which provides up-to-date versions of PHP.
Here’s a step-by-step guide:-

Step 1:- Enable the Remi Repository:-
a) Install the EPEL repository first, as Remi repository depends on it.
# [ sudo yum install epel-release ]
b) Now, enable the Remi repository.
# [ sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm ]
c) Enable the Remi repository.
# [ sudo yum-config-manager –enable remi-php74 ]

Step 2:- Install PHP 7.4:-
Now, you can install PHP 7.4 along with common extensions.
# [ sudo yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json ]

Step 3:- Start PHP-FPM (if you installed it):-
If you installed PHP-FPM, start and enable it to run on system boot.
# [ sudo systemctl start php-fpm ]
# [ sudo systemctl enable php-fpm ]

Step 4:- Verify the PHP Installation:-
You can check the installed PHP version with.
# [ php -v ]
This should display information about PHP, confirming that version 7.4 is installed.

Conclusion:- That’s it! You’ve successfully installed PHP 7.4 on CentOS 7 using the Remi repository. Adjust the package list as needed based on your specific requirements.