PHP 7.4 is the latest stable release of PHP. May of popular yum repositories is providing rpm packages for PHP 7. This article is using Remi and EPEL yum repositories for installing the required packages on your system. This article will help you to install PHP 7.4, PHP 7.3, PHP 7.2, PHP 7.1 on CentOS & Redhat 7 servers. This tutorial has been tested with CentOS Linux release 7.4.1708.
Setup Yum Repository
First of all, you need to enable Remi and EPEL yum repositories on your system. Use the following command to install EPEL repository on your CentOS and Red Hat 7/6 systems
Use this command to install EPEL yum repository on your system
sudo yum install epel-release
and now execute one of the following commands as per your operating system version to install the Remi repository.
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Install PHP 7 on CentOS
Your system is prepared for the PHP installation from yum repositories. Use one of the following commands to install PHP 7.4 or PHP 7.3 or PHP 7.2 or PHP 7.1 on your system based on your requirements.
## 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
I have installed the latest version PHP 7.4 on my system. Now running the following command to check the current active PHP version on my system.
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
Install PHP Modules
You may also need to install additional PHP modules based on your application requirements. The below command will install some more useful PHP modules.
### For PHP 7.4 yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt ### For PHP 7.3 yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt ### For PHP 7.2 yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt ### For PHP 7.1 yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
You can run the following command to search other available PHP modules under configured yum repositories. Below example command search for all modules for PHP 7.4.
How about installing php modules without internet?
Thank you so much
Probably better to follow official wizard instructions, see https://rpms.remirepo.net/wizard/
EL-7 way (1 repo per version) being very different than EL-8 way (1 stream per version).
And for question about my repository to use official forum.
# yum –enablerepo=remi-php73 install php
DigitalOcean Agent 119 kB/s | 3.3 kB 00:00
Package php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64 is already installed.
Nothing to do.
i am unable to update my php. i dont know what is wrong. Even if i use php74 repo, it still says
“”php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64 is already installed.
Nothing to do.””
what am i doing wrong ?
I lleave a response whenever I appreciate a pot on a site
or if I have something to contribute to the discussion. Usually it is caused
by the fire communicated in the post I read. And after this post How To Install PHP 7.4, 7.3 & 7.2 on CentOS 7 – TecAdmin. I was moved eenough to drop a thought 🙂 I do have 2 questions foor you if it’s
allright. Is it simply me or does it give the imprewsion like some of the comments appear aas if they are written by brain dead folks?
😛 And, if you are wrjting on additional places, I would like to keep up with you.
Would you list the complete urls of your sbared ssites like your linkedin profile,
Facebook page orr twitter feed?
Thank you man, I needed to do that using the ansible and this article helped me to have some ideas of how to do it.
Thank you so much! This is the best guide on the Internet. Now I have PHP 7.3 and it works more than fine.
I successfully installed php7.2 on my RHEL7. Now I need to install zend modules, does anyone knows how to do that? Baiscally l want following:
[[email protected] ~]# php -v
PHP 5.3.14 (cli) (built: Dec 10 2013 10:53:17)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend Technologies
– with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]
– with Zend Download Server v1.5.0, Copyright (c) 1998-2010 Zend Technologies Ltd., by Zend Technologies [loaded] [licensed] [disabled]
– with Zend Job Queue v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [not licensed] [disabled]
– with Zend Session Clustering v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]
– with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [enabled]
– with Zend Optimizer+ v4.1, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [disabled]
– with Zend Code Tracing v1.0, Copyright (c) 2009-2010, by Zend Technologies [loaded] [not licensed] [disabled]
– with Zend Page Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]
good one, keep returning to it..
Amazing, thank you!
This was very helpful, thank you!
warning: /var/tmp/rpm-tmp.YsDcyD: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
error: Failed dependencies:
epel-release = 7 is needed by remi-release-7.6-1.el7.remi.noarch
I think you must have figured out solution already but just in case anybody needs solution. I had same error and it was due to Centos6.
Use this yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm #CentOS/RHEL 6 instead of
Hope this helps , thanks!
Hi, first of all, thanks for your post. I’ve tried to update to php 7.3 but there is an error with the packet libargon2.so.0()(64bit). After a research on the Internet, it seems there are some packets not uptated yet for CentOS: https://blog.remirepo.net/pages/PECL-extensions-RPM-status
So I don’t know if there is a way to full update to PHP 7.3 with no errors. THX!!
Error: Paquete: php-7.3.1-1.el7.remi.x86_64 (remi-php73)
Error: Paquete: php-cli-7.3.1-1.el7.remi.x86_64 (remi-php73)
Error: Paquete: php-fpm-7.3.1-1.el7.remi.x86_64 (remi-php73)
I have PHP 5.4 , PHP 5.5, PHP, 5.6 installed and need to leave them installed. When I try to install php70w I get the error, “php70w-common-7.0.0-1.w7.x86_64 conflicts php-common < 5.5.0". Do your directions only work if we uninstall previous versions of PHP? If so, what should I do to make it work where multiple versions of PHP need to be installed?
You can manage multiple PHP versions using PHPBrew. It is also useful to switch between different versions of PHP.