How to install or upgrade to PHP 7 on CentOS 7 Linux Server - LinuxConfig.org


#1
The objective is to install or replace existing PHP 5 with PHP 7 on CentOS 7 Linux server. As you will see, this procedure is fairly simple when using Remi Repository.
This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-install-or-upgrade-to-php-7-on-centos-linux-server NOTE: SOME OF THE POSTS BELOW ARE TRANSFERRED FROM LINUXCONFIG DISQUS COMMENTS.

#2

Кирилл

Thankkssss so much


#3

Quan

Aaaanddd… ERR_CONNECTION_REFUSED after update. :slight_smile:
Any ideas?


#4

Prasenjit Barman

Which versions of PHP can i install in RHEL 6.9


#5

Sławomir Własik

Great article That’s what I was looking for. Thanks


#6

Kiko Seijo

Works like a charm, Grats, so simple,


#7

alaadahmed

didn’t work, still shows me php 5.4.16 … doesn’t want to update it and says “already installed and latest version … Nothing to do”


#8

Cristina -> alaadahmed

You have to uninstall php 5.4.16 before doing anything


#9

anonymous -> Cristina

how do you do that? The article starts out “…install or replace existing PHP 5 with PHP 7…”. Wonder why the author did not tell us we needed to uninstall PHP first. To me, replace means, well, replace.


#10

anonymous -> alaadahmed

had the same problem the first time, was because I already had the “EPEL Repository” active. So if u would then copy/past this line “rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm” it also did not activate the “Remi Repository”. If u already have the “EPEL Repository” active, use this line “rpm -Uvh remi-release-7.rpm” and after that the php7.0 or php7.1


#11

Phillip Mwaniki -> anonymous

Worked like a charm. Thanks!


#12

can you spell this out further?

If u already have the “EPEL Repository” active, use this line “rpm -Uvh remi-release-7.rpm” and after that the php7.0 or php7.1

what exactly does “and after that the php7.0 or php7.1” mean?

lk


#13

What is meant by that is that you choose which version of PHP 7 you wish to install. Now, there is also a PHP 7.2 available via REMI repository. After you have EPEL and REMI packages installed run one of the following:

FOR PHP 7.0 EXECUTE:
# yum-config-manager --enable remi-php70
FOR PHP 7.1 EXECUTE:
# yum-config-manager --enable remi-php71
FOR PHP 7.2 EXECUTE:
# yum-config-manager --enable remi-php72

Here is a video to show all steps for the entire PHP 7 installation on CentoOS 7:

Hope this helps!

Lubos