Home » PHP: Install PHP 7.2 on Linux – CentOS 7

PHP: Install PHP 7.2 on Linux – CentOS 7

by Pring
PHP: Install PHP 7.2 on Linux - CentOS 7

I. Introduction.

This tutorial will teaches you how to install PHP 7.2 on Linux – CentOS 7 server. PHP is a recursive acronym for PHP: Hypertext Preprocessor. It is server-side scripting. One can write dynamically generated web pages in PHP or embedded PHP directly into HTML. PHP offers built-in database integration for several commercial and non-commercial database management systems.

II. Prerequisites.

1.  Login to your system via SSH.  You can use PuTTy tool or Poderosa tool,…
2.  Login with root user.  If you are logged in as another user, you will need to add sudo before each command.

III. Install PHP on CentOS 7 by step by step.

To install PHP 7.2 on Linux – CentOS 7. Follow these steps:
Step 1. Turn on EPEL repository and utils package.
Step 2. Install and turn on Remi repository remi php7.2.
Step 3. Update repository.
Step 4. Install PHP version 7.2.
Step 5. Turn on PHP fpm for nginx.
Step 6. Start/Stop/Restart PHP fpm service.
Step 7. Testing the Installation.

You can see details of Video on How to Install PHP 7.2 on Linux – CentOS 7 as below.
[Sorry, the video we will update later]

Or you also can see details as below.

Step 1. Turn on EPEL repository and utils package.

The first step is to Enable the MariaDB repository. Create a repository file named MariaDB.repo.

Enter command below:

sudo yum install epel-release
sudo yum install yum-utils

Step 2. Install and turn on Remi repository remi php7.2.

Enter command below:

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

Sample Output:

[root@devopsio ~]# sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
remi-release-7.rpm                                                      |  16 kB  00:00:00     
Examining /var/tmp/yum-root-TGq5Ho/remi-release-7.rpm: remi-release-7.6-2.el7.remi.noarch
Marking /var/tmp/yum-root-TGq5Ho/remi-release-7.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package remi-release.noarch 0:7.6-2.el7.remi will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================
 Package               Arch            Version                  Repository                Size
===============================================================================================
Installing:
 remi-release          noarch          7.6-2.el7.remi           /remi-release-7           19 k

Transaction Summary
===============================================================================================
Install  1 Package

Total size: 19 k
Installed size: 19 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : remi-release-7.6-2.el7.remi.noarch                                          1/1 
  Verifying  : remi-release-7.6-2.el7.remi.noarch                                          1/1 

Installed:
  remi-release.noarch 0:7.6-2.el7.remi                                                         

Complete!

Step 3. Update repository.

Enter command below:

sudo yum update

Step 4. Install PHP version 7.2.

Enter command below:

sudo yum install php72

Sample Output:

[root@devopsio ~]# sudo yum install php72

Resolving Dependencies
--> Running transaction check
---> Package php72.x86_64 0:2.0-1.el7.remi will be installed
--> Processing Dependency: php72-runtime(x86-64) = 2.0-1.el7.remi for package: php72-2.0-1.el7.remi.x86_64
--> Processing Dependency: php72-runtime for package: php72-2.0-1.el7.remi.x86_64
--> Processing Dependency: php72-php-common(x86-64) for package: php72-2.0-1.el7.remi.x86_64
--> Processing Dependency: php72-php-cli(x86-64) for package: php72-2.0-1.el7.remi.x86_64
--> Running transaction check
---> Package php72-php-cli.x86_64 0:7.2.21-1.el7.remi will be installed
--> Processing Dependency: libargon2.so.0()(64bit) for package: php72-php-cli-7.2.21-1.el7.remi.x86_64
---> Package php72-php-common.x86_64 0:7.2.21-1.el7.remi will be installed
--> Processing Dependency: php72-php-json(x86-64) = 7.2.21-1.el7.remi for package: php72-php-common-7.2.21-1.el7.remi.x86_64
---> Package php72-runtime.x86_64 0:2.0-1.el7.remi will be installed
--> Processing Dependency: /usr/sbin/semanage for package: php72-runtime-2.0-1.el7.remi.x86_64
--> Processing Dependency: environment-modules for package: php72-runtime-2.0-1.el7.remi.x86_64
--> Processing Dependency: scl-utils for package: php72-runtime-2.0-1.el7.remi.x86_64
--> Running transaction check
---> Package environment-modules.x86_64 0:3.2.10-10.el7 will be installed
--> Processing Dependency: libtcl8.5.so()(64bit) for package: environment-modules-3.2.10-10.el7.x86_64
---> Package libargon2.x86_64 0:20161029-3.el7 will be installed
---> Package php72-php-json.x86_64 0:7.2.21-1.el7.remi will be installed
---> Package policycoreutils-python.x86_64 0:2.5-29.el7_6.1 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
---> Package scl-utils.x86_64 0:20130529-19.el7 will be installed
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.4-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-20.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
---> Package tcl.x86_64 1:8.5.13-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================
 Package                       Arch          Version                    Repository        Size
===============================================================================================
Installing:
 php72                         x86_64        2.0-1.el7.remi             remi-safe        2.4 k
Installing for dependencies:
 audit-libs-python             x86_64        2.8.4-4.el7                base              76 k
 checkpolicy                   x86_64        2.5-8.el7                  base             295 k
 environment-modules           x86_64        3.2.10-10.el7              base             107 k
 libargon2                     x86_64        20161029-3.el7             epel              23 k
 libcgroup                     x86_64        0.41-20.el7                base              66 k
 libsemanage-python            x86_64        2.5-14.el7                 base             113 k
 php72-php-cli                 x86_64        7.2.21-1.el7.remi          remi-safe        3.2 M
 php72-php-common              x86_64        7.2.21-1.el7.remi          remi-safe        638 k
 php72-php-json                x86_64        7.2.21-1.el7.remi          remi-safe         68 k
 php72-runtime                 x86_64        2.0-1.el7.remi             remi-safe        1.1 M
 policycoreutils-python        x86_64        2.5-29.el7_6.1             updates          456 k
 python-IPy                    noarch        0.75-6.el7                 base              32 k
 scl-utils                     x86_64        20130529-19.el7            base              24 k
 setools-libs                  x86_64        3.3.8-4.el7                base             620 k
 tcl                           x86_64        1:8.5.13-8.el7             base             1.9 M

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

Total download size: 8.7 M
Installed size: 26 M
Is this ok [y/d/N]: Exiting on user command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx.2019-08-04.08-05.Wk8iqq.yumtx

But that is not enough. You must install additional modules:
Enter command below:

sudo yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache

Sample Output:

[root@devopsio ~]# sudo yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache
Resolving Dependencies
--> Running transaction check
---> Package php72-php-fpm.x86_64 0:7.2.21-1.el7.remi will be installed
--> Processing Dependency: php72-php-common(x86-64) = 7.2.21-1.el7.remi for package: php72-php-fpm-7.2.21-1.el7.remi.x86_64
--> Processing Dependency: libargon2.so.0()(64bit) for package: php72-php-fpm-7.2.21-1.el7.remi.x86_64
---> Package php72-php-gd.x86_64 0:7.2.21-1.el7.remi will be installed
--> Processing Dependency: gd-last(x86-64) >= 2.1.1 for package: php72-php-gd-7.2.21-1.el7.remi.x86_64
--> Processing Dependency: libgd.so.3()(64bit) for package: php72-php-gd-7.2.21-1.el7.remi.x86_64
---> Package php72-php-json.x86_64 0:7.2.21-1.el7.remi will be installed
---> Package php72-php-mbstring.x86_64 0:7.2.21-1.el7.remi will be installed
--> Processing Dependency: libonig.so.5()(64bit) for package: php72-php-mbstring-7.2.21-1.el7.remi.x86_64
---> Package php72-php-mysqlnd.x86_64 0:7.2.21-1.el7.remi will be installed
--> Processing Dependency: php72-php-pdo(x86-64) = 7.2.21-1.el7.remi for package: php72-php-mysqlnd-7.2.21-1.el7.remi.x86_64
---> Package php72-php-opcache.x86_64 0:7.2.21-1.el7.remi will be installed
---> Package php72-php-xml.x86_64 0:7.2.21-1.el7.remi will be installed
---> Package php72-php-xmlrpc.x86_64 0:7.2.21-1.el7.remi will be installed
--> Running transaction check
---> Package gd-last.x86_64 0:2.2.5-8.el7.remi will be installed
--> Processing Dependency: libtiff.so.5(LIBTIFF_4.0)(64bit) for package: gd-last-2.2.5-8.el7.remi.x86_64
--> Processing Dependency: libtiff.so.5()(64bit) for package: gd-last-2.2.5-8.el7.remi.x86_64
--> Processing Dependency: libwebp.so.7()(64bit) for package: gd-last-2.2.5-8.el7.remi.x86_64
---> Package libargon2.x86_64 0:20161029-3.el7 will be installed
---> Package oniguruma5.x86_64 0:6.9.2-2.el7.remi will be installed
---> Package php72-php-common.x86_64 0:7.2.21-1.el7.remi will be installed
--> Processing Dependency: php72-runtime for package: php72-php-common-7.2.21-1.el7.remi.x86_64
---> Package php72-php-pdo.x86_64 0:7.2.21-1.el7.remi will be installed
--> Running transaction check
---> Package libtiff.x86_64 0:4.0.3-27.el7_3 will be installed
--> Processing Dependency: libjbig.so.2.0()(64bit) for package: libtiff-4.0.3-27.el7_3.x86_64
---> Package libwebp7.x86_64 0:1.0.2-1.el7.remi will be installed
---> Package php72-runtime.x86_64 0:2.0-1.el7.remi will be installed
--> Processing Dependency: /usr/sbin/semanage for package: php72-runtime-2.0-1.el7.remi.x86_64
--> Processing Dependency: environment-modules for package: php72-runtime-2.0-1.el7.remi.x86_64
--> Processing Dependency: scl-utils for package: php72-runtime-2.0-1.el7.remi.x86_64
--> Running transaction check
---> Package environment-modules.x86_64 0:3.2.10-10.el7 will be installed
--> Processing Dependency: libtcl8.5.so()(64bit) for package: environment-modules-3.2.10-10.el7.x86_64
---> Package jbigkit-libs.x86_64 0:2.0-11.el7 will be installed
---> Package policycoreutils-python.x86_64 0:2.5-29.el7_6.1 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
---> Package scl-utils.x86_64 0:20130529-19.el7 will be installed
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.4-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-20.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
---> Package tcl.x86_64 1:8.5.13-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================
 Package                       Arch          Version                    Repository        Size
===============================================================================================
Installing:
 php72-php-fpm                 x86_64        7.2.21-1.el7.remi          remi-safe        1.7 M
 php72-php-gd                  x86_64        7.2.21-1.el7.remi          remi-safe         78 k
 php72-php-json                x86_64        7.2.21-1.el7.remi          remi-safe         68 k
 php72-php-mbstring            x86_64        7.2.21-1.el7.remi          remi-safe        460 k
 php72-php-mysqlnd             x86_64        7.2.21-1.el7.remi          remi-safe        180 k
 php72-php-opcache             x86_64        7.2.21-1.el7.remi          remi-safe        221 k
 php72-php-xml                 x86_64        7.2.21-1.el7.remi          remi-safe        173 k
 php72-php-xmlrpc              x86_64        7.2.21-1.el7.remi          remi-safe         83 k
Installing for dependencies:
 audit-libs-python             x86_64        2.8.4-4.el7                base              76 k
 checkpolicy                   x86_64        2.5-8.el7                  base             295 k
 environment-modules           x86_64        3.2.10-10.el7              base             107 k
 gd-last                       x86_64        2.2.5-8.el7.remi           remi-safe        134 k
 jbigkit-libs                  x86_64        2.0-11.el7                 base              46 k
 libargon2                     x86_64        20161029-3.el7             epel              23 k
 libcgroup                     x86_64        0.41-20.el7                base              66 k
 libsemanage-python            x86_64        2.5-14.el7                 base             113 k
 libtiff                       x86_64        4.0.3-27.el7_3             base             170 k
 libwebp7                      x86_64        1.0.2-1.el7.remi           remi-safe        265 k
 oniguruma5                    x86_64        6.9.2-2.el7.remi           remi-safe        192 k
 php72-php-common              x86_64        7.2.21-1.el7.remi          remi-safe        638 k
 php72-php-pdo                 x86_64        7.2.21-1.el7.remi          remi-safe        114 k
 php72-runtime                 x86_64        2.0-1.el7.remi             remi-safe        1.1 M
 policycoreutils-python        x86_64        2.5-29.el7_6.1             updates          456 k
 python-IPy                    noarch        0.75-6.el7                 base              32 k
 scl-utils                     x86_64        20130529-19.el7            base              24 k
 setools-libs                  x86_64        3.3.8-4.el7                base             620 k
 tcl                           x86_64        1:8.5.13-8.el7             base             1.9 M

Transaction Summary
===============================================================================================
Install  8 Packages (+19 Dependent packages)

Total download size: 9.2 M
Installed size: 26 M
Is this ok [y/d/N]: y
Downloading packages:
(1/27): audit-libs-python-2.8.4-4.el7.x86_64.rpm                        |  76 kB  00:00:00     
(2/27): environment-modules-3.2.10-10.el7.x86_64.rpm                    | 107 kB  00:00:00     
(3/27): jbigkit-libs-2.0-11.el7.x86_64.rpm                              |  46 kB  00:00:00     
(4/27): checkpolicy-2.5-8.el7.x86_64.rpm                                | 295 kB  00:00:00     
(5/27): libcgroup-0.41-20.el7.x86_64.rpm                                |  66 kB  00:00:00     
(6/27): libtiff-4.0.3-27.el7_3.x86_64.rpm                               | 170 kB  00:00:00     
(7/27): libsemanage-python-2.5-14.el7.x86_64.rpm                        | 113 kB  00:00:00     
(8/27): libargon2-20161029-3.el7.x86_64.rpm                             |  23 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/remi-safe/packages/gd-last-2.2.5-8.el7.remi.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Public key for gd-last-2.2.5-8.el7.remi.x86_64.rpm is not installed
(9/27): gd-last-2.2.5-8.el7.remi.x86_64.rpm                             | 134 kB  00:00:01     
(10/27): php72-php-gd-7.2.21-1.el7.remi.x86_64.rpm                      |  78 kB  00:00:00     
(11/27): libwebp7-1.0.2-1.el7.remi.x86_64.rpm                           | 265 kB  00:00:01     
(12/27): php72-php-json-7.2.21-1.el7.remi.x86_64.rpm                    |  68 kB  00:00:00     
(13/27): php72-php-mysqlnd-7.2.21-1.el7.remi.x86_64.rpm                 | 180 kB  00:00:00     
(14/27): php72-php-opcache-7.2.21-1.el7.remi.x86_64.rpm                 | 221 kB  00:00:00     
(15/27): php72-php-pdo-7.2.21-1.el7.remi.x86_64.rpm                     | 114 kB  00:00:00     
(16/27): php72-php-common-7.2.21-1.el7.remi.x86_64.rpm                  | 638 kB  00:00:01     
(17/27): php72-php-xml-7.2.21-1.el7.remi.x86_64.rpm                     | 173 kB  00:00:00     
(18/27): php72-php-mbstring-7.2.21-1.el7.remi.x86_64.rpm                | 460 kB  00:00:00     
(19/27): php72-php-xmlrpc-7.2.21-1.el7.remi.x86_64.rpm                  |  83 kB  00:00:00     
(20/27): policycoreutils-python-2.5-29.el7_6.1.x86_64.rpm               | 456 kB  00:00:00     
(21/27): scl-utils-20130529-19.el7.x86_64.rpm                           |  24 kB  00:00:00     
(22/27): setools-libs-3.3.8-4.el7.x86_64.rpm                            | 620 kB  00:00:00     
(23/27): tcl-8.5.13-8.el7.x86_64.rpm                                    | 1.9 MB  00:00:00     
(24/27): python-IPy-0.75-6.el7.noarch.rpm                               |  32 kB  00:00:00     
(25/27): php72-runtime-2.0-1.el7.remi.x86_64.rpm                        | 1.1 MB  00:00:00     
(26/27): oniguruma5-6.9.2-2.el7.remi.x86_64.rpm                         | 192 kB  00:00:02     
(27/27): php72-php-fpm-7.2.21-1.el7.remi.x86_64.rpm                     | 1.7 MB  00:00:04     
-----------------------------------------------------------------------------------------------
Total                                                          1.7 MB/s | 9.2 MB  00:00:05     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Importing GPG key 0x00F97F56:
 Userid     : "Remi Collet <RPMS@FamilleCollet.com>"
 Fingerprint: 1ee0 4cce 88a4 ae4a a29a 5df5 004e 6f47 00f9 7f56
 Package    : remi-release-7.6-2.el7.remi.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : oniguruma5-6.9.2-2.el7.remi.x86_64                                         1/27 
  Installing : jbigkit-libs-2.0-11.el7.x86_64                                             2/27 
  Installing : libtiff-4.0.3-27.el7_3.x86_64                                              3/27 
  Installing : audit-libs-python-2.8.4-4.el7.x86_64                                       4/27 
  Installing : libwebp7-1.0.2-1.el7.remi.x86_64                                           5/27 
  Installing : gd-last-2.2.5-8.el7.remi.x86_64                                            6/27 
  Installing : checkpolicy-2.5-8.el7.x86_64                                               7/27 
  Installing : libsemanage-python-2.5-14.el7.x86_64                                       8/27 
  Installing : setools-libs-3.3.8-4.el7.x86_64                                            9/27 
  Installing : python-IPy-0.75-6.el7.noarch                                              10/27 
  Installing : scl-utils-20130529-19.el7.x86_64                                          11/27 
  Installing : libargon2-20161029-3.el7.x86_64                                           12/27 
  Installing : libcgroup-0.41-20.el7.x86_64                                              13/27 
  Installing : policycoreutils-python-2.5-29.el7_6.1.x86_64                              14/27 
  Installing : 1:tcl-8.5.13-8.el7.x86_64                                                 15/27 
  Installing : environment-modules-3.2.10-10.el7.x86_64                                  16/27 
  Installing : php72-runtime-2.0-1.el7.remi.x86_64                                       17/27 
  Installing : php72-php-json-7.2.21-1.el7.remi.x86_64                                   18/27 
  Installing : php72-php-common-7.2.21-1.el7.remi.x86_64                                 19/27 
  Installing : php72-php-xml-7.2.21-1.el7.remi.x86_64                                    20/27 
  Installing : php72-php-pdo-7.2.21-1.el7.remi.x86_64                                    21/27 
  Installing : php72-php-mysqlnd-7.2.21-1.el7.remi.x86_64                                22/27 
  Installing : php72-php-xmlrpc-7.2.21-1.el7.remi.x86_64                                 23/27 
  Installing : php72-php-fpm-7.2.21-1.el7.remi.x86_64                                    24/27 
  Installing : php72-php-mbstring-7.2.21-1.el7.remi.x86_64                               25/27 
  Installing : php72-php-gd-7.2.21-1.el7.remi.x86_64                                     26/27 
  Installing : php72-php-opcache-7.2.21-1.el7.remi.x86_64                                27/27 
  Verifying  : php72-php-xml-7.2.21-1.el7.remi.x86_64                                     1/27 
  Verifying  : 1:tcl-8.5.13-8.el7.x86_64                                                  2/27 
  Verifying  : libtiff-4.0.3-27.el7_3.x86_64                                              3/27 
  Verifying  : php72-php-fpm-7.2.21-1.el7.remi.x86_64                                     4/27 
  Verifying  : libcgroup-0.41-20.el7.x86_64                                               5/27 
  Verifying  : environment-modules-3.2.10-10.el7.x86_64                                   6/27 
  Verifying  : libargon2-20161029-3.el7.x86_64                                            7/27 
  Verifying  : php72-php-mysqlnd-7.2.21-1.el7.remi.x86_64                                 8/27 
  Verifying  : scl-utils-20130529-19.el7.x86_64                                           9/27 
  Verifying  : php72-php-mbstring-7.2.21-1.el7.remi.x86_64                               10/27 
  Verifying  : python-IPy-0.75-6.el7.noarch                                              11/27 
  Verifying  : php72-php-json-7.2.21-1.el7.remi.x86_64                                   12/27 
  Verifying  : setools-libs-3.3.8-4.el7.x86_64                                           13/27 
  Verifying  : policycoreutils-python-2.5-29.el7_6.1.x86_64                              14/27 
  Verifying  : libsemanage-python-2.5-14.el7.x86_64                                      15/27 
  Verifying  : php72-php-xmlrpc-7.2.21-1.el7.remi.x86_64                                 16/27 
  Verifying  : php72-php-pdo-7.2.21-1.el7.remi.x86_64                                    17/27 
  Verifying  : php72-php-gd-7.2.21-1.el7.remi.x86_64                                     18/27 
  Verifying  : php72-php-opcache-7.2.21-1.el7.remi.x86_64                                19/27 
  Verifying  : checkpolicy-2.5-8.el7.x86_64                                              20/27 
  Verifying  : gd-last-2.2.5-8.el7.remi.x86_64                                           21/27 
  Verifying  : php72-php-common-7.2.21-1.el7.remi.x86_64                                 22/27 
  Verifying  : libwebp7-1.0.2-1.el7.remi.x86_64                                          23/27 
  Verifying  : audit-libs-python-2.8.4-4.el7.x86_64                                      24/27 
  Verifying  : php72-runtime-2.0-1.el7.remi.x86_64                                       25/27 
  Verifying  : jbigkit-libs-2.0-11.el7.x86_64                                            26/27 
  Verifying  : oniguruma5-6.9.2-2.el7.remi.x86_64                                        27/27 

Installed:
  php72-php-fpm.x86_64 0:7.2.21-1.el7.remi      php72-php-gd.x86_64 0:7.2.21-1.el7.remi       
  php72-php-json.x86_64 0:7.2.21-1.el7.remi     php72-php-mbstring.x86_64 0:7.2.21-1.el7.remi 
  php72-php-mysqlnd.x86_64 0:7.2.21-1.el7.remi  php72-php-opcache.x86_64 0:7.2.21-1.el7.remi  
  php72-php-xml.x86_64 0:7.2.21-1.el7.remi      php72-php-xmlrpc.x86_64 0:7.2.21-1.el7.remi   

Dependency Installed:
  audit-libs-python.x86_64 0:2.8.4-4.el7          checkpolicy.x86_64 0:2.5-8.el7              
  environment-modules.x86_64 0:3.2.10-10.el7      gd-last.x86_64 0:2.2.5-8.el7.remi           
  jbigkit-libs.x86_64 0:2.0-11.el7                libargon2.x86_64 0:20161029-3.el7           
  libcgroup.x86_64 0:0.41-20.el7                  libsemanage-python.x86_64 0:2.5-14.el7      
  libtiff.x86_64 0:4.0.3-27.el7_3                 libwebp7.x86_64 0:1.0.2-1.el7.remi          
  oniguruma5.x86_64 0:6.9.2-2.el7.remi            php72-php-common.x86_64 0:7.2.21-1.el7.remi 
  php72-php-pdo.x86_64 0:7.2.21-1.el7.remi        php72-runtime.x86_64 0:2.0-1.el7.remi       
  policycoreutils-python.x86_64 0:2.5-29.el7_6.1  python-IPy.noarch 0:0.75-6.el7              
  scl-utils.x86_64 0:20130529-19.el7              setools-libs.x86_64 0:3.3.8-4.el7           
  tcl.x86_64 1:8.5.13-8.el7                      

Complete!

Step 5. Turn on PHP fpm for nginx.

Enter command below:

sudo systemctl enable php72-php-fpm.service

Sample Output:

[root@devopsio ~]# sudo systemctl enable php72-php-fpm.service
Created symlink from /etc/systemd/system/multi-user.target.wants/php72-php-fpm.service to /usr/lib/systemd/system/php72-php-fpm.service.

Step 6. Start/Stop/Restart PHP fpm service.

Enter command below:

sudo systemctl start php72-php-fpm.service
sudo systemctl stop php72-php-fpm.service
sudo systemctl restart php72-php-fpm.service

You use the first comand to start the PHP service.

Step 7. Testing the Installation.

Enter command below:

sudo systemctl status php72-php-fpm.service

Sample Output:

[root@devopsio ~]# sudo systemctl status php72-php-fpm.service
● php72-php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php72-php-fpm.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2019-08-04 08:13:28 UTC; 7min ago
 Main PID: 1889 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/php72-php-fpm.service
           ├─1889 php-fpm: master process (/etc/opt/remi/php72/php-fpm.conf)
           ├─1890 php-fpm: pool www
           ├─1891 php-fpm: pool www
           ├─1892 php-fpm: pool www
           ├─1893 php-fpm: pool www
           └─1894 php-fpm: pool www

IV. Conclusion.

In this tutorial, we was install PHP on CentOS 7 server. In next part of the series I will show you how to displays a basic website use PHP running Nginx server.


Install PHP Linux – CentOS 7 is complete. Wish you success and luck.
Thanks and best regards!
— Pring —

Related Articles

Leave a Comment