ゴジラ

Installing PHP 7 on CentOS 7

At the time of writing this post, CentOS 7 has PHP 5.4.xx in it's repository by default, as seen below, to install CentOS 7, we need a few additional repositories enabled,

[root@localhost ~]# yum install php

Dependencies Resolved

================================================================================
 Package           Arch         Version                     Repository     Size
================================================================================
Installing:
 php               x86_64       5.4.16-36.1.el7_2.1         updates       1.4 M
Installing for dependencies:
 apr               x86_64       1.4.8-3.el7                 base          103 k
 apr-util          x86_64       1.5.2-6.el7                 base           92 k
 httpd             x86_64       2.4.6-40.el7.centos.4       updates       2.7 M
 httpd-tools       x86_64       2.4.6-40.el7.centos.4       updates        83 k
 libzip            x86_64       0.10.1-8.el7                base           48 k
 mailcap           noarch       2.1.41-2.el7                base           31 k
 php-cli           x86_64       5.4.16-36.1.el7_2.1         updates       2.7 M
 php-common        x86_64       5.4.16-36.1.el7_2.1         updates       563 k

Transaction Summary
================================================================================
Install  1 Package (+8 Dependent packages)

Total download size: 7.7 M
Installed size: 27 M
Is this ok [y/d/N]: n
Exiting on user command

Install the EPEL Repository,

yum install epel-release

Install the REMI Repository,

wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm

Next install yum-utils for yum-config-manager,

yum install yum-utils

Enable the remi-php70 repository,

yum-config-manager --enable remi-php70

Let's try installing php now,

[root@localhost ~]# yum install php

Dependencies Resolved

================================================================================
 Package          Arch        Version                     Repository       Size
================================================================================
Installing:
 php              x86_64      7.0.8-1.el7.remi            remi-php70      2.6 M
Installing for dependencies:
 apr              x86_64      1.4.8-3.el7                 base            103 k
 apr-util         x86_64      1.5.2-6.el7                 base             92 k
 httpd            x86_64      2.4.6-40.el7.centos.4       updates         2.7 M
 httpd-tools      x86_64      2.4.6-40.el7.centos.4       updates          83 k
 mailcap          noarch      2.1.41-2.el7                base             31 k
 php-cli          x86_64      7.0.8-1.el7.remi            remi-php70      3.9 M
 php-common       x86_64      7.0.8-1.el7.remi            remi-php70      995 k
 php-json         x86_64      7.0.8-1.el7.remi            remi-php70       53 k

Transaction Summary
================================================================================
Install  1 Package (+8 Dependent packages)

Total download size: 11 M
Installed size: 39 M
Is this ok [y/d/N]: y

As seen above, the PHP version being installed now is 7.0.8-1.el7.remi from the remi-php70 repository we enabled earlier on.


Last modified: December 06 2019 14:21:55