Как установить PHP — для работы с VPS на CentOS ?

Бесплатный и стабильный репозиторий REMI, который создается и поддерживается французом Remi Collect.

Установка PHP на CentOS 7 из репозитория REMI.

PHP поддерживает множество современных веб-серверов, например, Apache, IIS (Microsoft Internet Information Server), Netscape, Personal Web Server, iPlanet, Oreilly Website Pro, Caudium, Xitami, OmniHTTPd. Для большинства из них PHP исполняется как модуль - Apache (SAPI) или CGI-программа на стороне сервера.
По умолчанию в официальных хранилищах программного обеспечения CentOS 7 есть версия PHP 5.4, которая больше не поддерживается разработчиками. Чтобы не отставать от новейших функций и обновлений безопасности, вам нужна более новая (возможно, последняя) версия PHP для вашей системы CentOS 7.
Поэтому настоятельно рекомендуется обновить или установить последнюю поддерживаемую стабильную версию PHP 5.6 или PHP 7 в дистрибутиве CentOS 7 Linux.
Вы должны использовать репозиторий REMI вместе с репозиторием EPEL. В противном случае иногда может возникнуть проблема зависимости.

  Установка PHP на CentOS 7

Чтобы установить PHP в систему CentOS 7, вам необходимо установить и включить репозиторий EPEL и Remi, который предлагает последние версии PHP - для дистрибутивах CentOS / RHEL 7, используя приведенные ниже команды.

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install //rpms.remirepo.net/enterprise/remi-release-7.rpm

root@avege ~

Using username "root".
root@88.212.253.127's password:
Send automatic password

[root@avege ~]# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Loaded plugins: fastestmirror
epel-release-latest-7.noarch.rpm                       |  15 kB     00:00
Examining /var/tmp/yum-root-bzMND3/epel-release-latest-7.noarch.rpm: epel-release-7-11.noarch
Marking /var/tmp/yum-root-bzMND3/epel-release-latest-7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================
 Package          Arch       Version    Repository                   Size
===========================================================================
Installing:
 epel-release     noarch     7-11  /epel-release-latest-7.noarch     24 k

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

Total size: 24 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                              1/1
  Verifying  : epel-release-7-11.noarch                              1/1

Installed:
  epel-release.noarch 0:7-11

Complete!

[root@avege ~]# yum install //rpms.remirepo.net/enterprise/remi-release-7.rpm

Loaded plugins: fastestmirror
remi-release-7.rpm                                    |  15 kB     00:00
Examining /var/tmp/yum-root-bzMND3/remi-release-7.rpm: remi-release-7.5-2.el7.remi.noarch
Marking /var/tmp/yum-root-bzMND3/remi-release-7.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package remi-release.noarch 0:7.5-2.el7.remi will be installed
--> Finished Dependency Resolution

Dependencies Resolved

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

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

Total size: 18 k
Installed size: 18 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.5-2.el7.remi.noarch                    1/1
  Verifying  : remi-release-7.5-2.el7.remi.noarch                    1/1

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

Complete!

[root@avege ~]#						

Затем установите yum-utils, который представляет собой набор утилит, которые интегрируются с yum для улучшения своих функций по умолчанию, предоставляя ему более сложные варианты управления пакетами, а также упрощая их использование.
Некоторые из его важных функций включают в себя манипулирование репозиториями, включение или отключение пакетов на ходу и многое другое без каких-либо ручных конфигураций.

yum install yum-utils

Установка - yum install yum-utils

root@avege ~

Using username "root".
root@88.212.253.127's password:
Send automatic password

[root@avege ~]# yum install yum-utils

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                     |  29 kB     00:00
 * base: dedic.sh
 * epel: fedora-mirror01.rbc.ru
 * extras: dedic.sh
 * remi-safe: mirror.reconn.ru
 * updates: dedic.sh
base                                                     | 3.6 kB     00:00
epel                                                     | 3.2 kB     00:00
extras                                                   | 3.4 kB     00:00
nginx                                                    | 2.9 kB     00:00
remi-safe                                                | 2.9 kB     00:00
updates                                                  | 3.4 kB     00:00
(1/4): epel/x86_64/group_gz                                |  88 kB   00:00
(2/4): epel/x86_64/updateinfo                              | 933 kB   00:00
(3/4): remi-safe/primary_db                                | 1.3 MB   00:00
(4/4): epel/x86_64/primary                                 | 3.6 MB   00:01
epel                                                       12756/12756
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-46.el7_5 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-46.el7_5.noarch
--> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-46.el7_5.noarch
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.9.1-6.el7_2.3 will be installed
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
--> Running transaction check
---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================
 Package              Arch       Version            Repository     Size
===========================================================================
Installing:
 yum-utils            noarch     1.1.31-46.el7_5     updates       120 k
Installing for dependencies:
 libxml2-python       x86_64       2.9.1-6.el7_2.3          base          247 k
 python-chardet       noarch       2.2.1-1.el7_1            base          227 k
 python-kitchen       noarch       1.1.1-5.el7              base          267 k

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

Total download size: 860 k
Installed size: 4.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm           | 247 kB   00:00
(2/4): yum-utils-1.1.31-46.el7_5.noarch.rpm                | 120 kB   00:00
(3/4): python-kitchen-1.1.1-5.el7.noarch.rpm               | 267 kB   00:00
(4/4): python-chardet-2.2.1-1.el7_1.noarch.rpm             | 227 kB   00:00
---------------------------------------------------------------------------
Total                                              2.1 MB/s | 860 kB  00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-chardet-2.2.1-1.el7_1.noarch                          1/4
  Installing : python-kitchen-1.1.1-5.el7.noarch                            2/4
  Installing : libxml2-python-2.9.1-6.el7_2.3.x86_64                        3/4
  Installing : yum-utils-1.1.31-46.el7_5.noarch                             4/4
  Verifying  : libxml2-python-2.9.1-6.el7_2.3.x86_64                        1/4
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                            2/4
  Verifying  : yum-utils-1.1.31-46.el7_5.noarch                             3/4
  Verifying  : python-chardet-2.2.1-1.el7_1.noarch                          4/4

Installed:
  yum-utils.noarch 0:1.1.31-46.el7_5

Dependency Installed:
  libxml2-python.x86_64 0:2.9.1-6.el7_2.3 python-chardet.noarch 0:2.2.1-1.el7_1
  python-kitchen.noarch 0:1.1.1-5.el7

Complete!
[root@avege ~]#
						

yum-utils - набор инструментов и программ для управления репозиториями yum, установки пакетов отладки, исходных пакетов, расширенной информации из репозиториев и администрирования.
Одной из наиболее важных программ, предоставляемых yum-utils, является yum-config-manager, который вы можете использовать, для активного репозитория Remi в качестве репозитория по умолчанию, для установки различных версий PHP. Например, если вы хотите установить PHP 5.5, PHP 5.6 или PHP 7.2 на CentOS 7, просто включите его и установите, как показано.

yum-config-manager --enable remi-php55 [Установить PHP 5.5]
yum-config-manager --enable remi-php56 [Установить PHP 5.6]
yum-config-manager --enable remi-php70 [Установить PHP 7.0]
yum-config-manager --enable remi-php71 [Установить PHP 7.1]
yum-config-manager --enable remi-php72 [Установить PHP 7.2]

Можно использовать Мастер настройки RPM-репозитория Remi
выберите свою версию и режим установки.

Команда для включения репозитория - yum-config-manager --enable remi-php72 на CentOS 7.

root@avege ~

	Using username "root".
root@88.212.253.127's password:
Send automatic password

[root@avege ~]# yum-config-manager --enable remi-php72

Loaded plugins: fastestmirror
=============================== repo: remi-php72 ===============================
[remi-php72]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl =
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php72
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php72/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php72/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php72/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist = //cdn.remirepo.net/enterprise/7/php72/mirror
mirrorlist_expire = 86400
name = Remi's PHP 7.2 RPM repository for Enterprise Linux 7 - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php72
pkgdir = /var/cache/yum/x86_64/7/remi-php72/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php72
ui_repoid_vars = releasever,
   basearch
username =

[root@avege ~]#
	

Теперь, когда вы включили выбранные версии PHP, вы можете установить PHP (здесь устанавливаетя PHP 7) со всеми необходимыми модулями следующим образом:

yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

Команда для установки PHP и дополнительных пакетов -
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

root@avege ~

Using username "root".
root@88.212.253.127's password:
Send automatic password

[root@avege ~]#  yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: dedic.sh
 * epel: fedora-mirror01.rbc.ru
 * extras: dedic.sh
 * remi-php72: mirror.reconn.ru
 * remi-safe: mirror.reconn.ru
 * updates: dedic.sh
remi-php72                                               | 2.9 kB     00:00
remi-php72/primary_db                                      | 198 kB   00:00
Package php-mcrypt is obsoleted by php-pecl-mcrypt, trying to install php-pecl-mcrypt-1.0.1-6.el7.remi.7.2.x86_64 instead
Package php-mysql is obsoleted by php-mysqlnd, trying to install php-mysqlnd-7.2.11-1.el7.remi.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:7.2.11-1.el7.remi will be installed
--> Processing Dependency: libargon2.so.0()(64bit) for package: php-7.2.11-1.el7.remi.x86_64
---> Package php-cli.x86_64 0:7.2.11-1.el7.remi will be installed
---> Package php-common.x86_64 0:7.2.11-1.el7.remi will be installed
--> Processing Dependency: php-json(x86-64) = 7.2.11-1.el7.remi for package: php-common-7.2.11-1.el7.remi.x86_64
---> Package php-gd.x86_64 0:7.2.11-1.el7.remi will be installed
--> Processing Dependency: gd-last(x86-64) >= 2.1.1 for package: php-gd-7.2.11-1.el7.remi.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: php-gd-7.2.11-1.el7.remi.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: php-gd-7.2.11-1.el7.remi.x86_64
--> Processing Dependency: libgd.so.3()(64bit) for package: php-gd-7.2.11-1.el7.remi.x86_64
--> Processing Dependency: libfreetype.so.6()(64bit) for package: php-gd-7.2.11-1.el7.remi.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-7.2.11-1.el7.remi.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-7.2.11-1.el7.remi.x86_64
---> Package php-ldap.x86_64 0:7.2.11-1.el7.remi will be installed
---> Package php-mysqlnd.x86_64 0:7.2.11-1.el7.remi will be installed
--> Processing Dependency: php-pdo(x86-64) = 7.2.11-1.el7.remi for package: php-mysqlnd-7.2.11-1.el7.remi.x86_64
---> Package php-pecl-mcrypt.x86_64 0:1.0.1-6.el7.remi.7.2 will be installed
--> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-pecl-mcrypt-1.0.1-6.el7.remi.7.2.x86_64
---> Package php-pecl-zip.x86_64 0:1.15.4-1.el7.remi.7.2 will be installed
--> Processing Dependency: libzip5(x86-64) >= 1.5.1 for package: php-pecl-zip-1.15.4-1.el7.remi.7.2.x86_64
--> Processing Dependency: libzip.so.5()(64bit) for package: php-pecl-zip-1.15.4-1.el7.remi.7.2.x86_64
--> Running transaction check
---> Package freetype.x86_64 0:2.4.11-15.el7 will be installed
---> Package gd-last.x86_64 0:2.2.5-5.el7.remi will be installed
--> Processing Dependency: libtiff.so.5(LIBTIFF_4.0)(64bit) for package: gd-last-2.2.5-5.el7.remi.x86_64
--> Processing Dependency: libwebp.so.4()(64bit) for package: gd-last-2.2.5-5.el7.remi.x86_64
--> Processing Dependency: libtiff.so.5()(64bit) for package: gd-last-2.2.5-5.el7.remi.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: gd-last-2.2.5-5.el7.remi.x86_64
---> Package libX11.x86_64 0:1.6.5-1.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.5-1.el7 for package: libX11-1.6.5-1.el7.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-1.el7.x86_64
---> Package libXpm.x86_64 0:3.5.12-1.el7 will be installed
---> Package libargon2.x86_64 0:20161029-2.el7 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.90-5.el7 will be installed
---> Package libmcrypt.x86_64 0:2.5.8-13.el7 will be installed
---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed
---> Package libzip5.x86_64 0:1.5.1-1.el7.remi will be installed
---> Package php-json.x86_64 0:7.2.11-1.el7.remi will be installed
---> Package php-pdo.x86_64 0:7.2.11-1.el7.remi will be installed
--> Running transaction check
---> Package fontconfig.x86_64 0:2.10.95-11.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.10.95-11.el7.x86_64
--> Processing Dependency: font(:lang=en) for package: fontconfig-2.10.95-11.el7.x86_64
---> Package libX11-common.noarch 0:1.6.5-1.el7 will be installed
---> 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 libwebp.x86_64 0:0.3.0-7.el7 will be installed
---> Package libxcb.x86_64 0:1.12-1.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.12-1.el7.x86_64
--> Running transaction check
---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
---> Package jbigkit-libs.x86_64 0:2.0-11.el7 will be installed
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package lyx-fonts.noarch 0:2.2.3-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch     Version                  Repository    Size
================================================================================
Installing:
 php                       x86_64   7.2.11-1.el7.remi        remi-php72   3.2 M
 php-cli                   x86_64   7.2.11-1.el7.remi        remi-php72   4.8 M
 php-common                x86_64   7.2.11-1.el7.remi        remi-php72   1.1 M
 php-gd                    x86_64   7.2.11-1.el7.remi        remi-php72    77 k
 php-ldap                  x86_64   7.2.11-1.el7.remi        remi-php72    69 k
 php-mysqlnd               x86_64   7.2.11-1.el7.remi        remi-php72   232 k
 php-pecl-mcrypt           x86_64   1.0.1-6.el7.remi.7.2     remi-php72    29 k
 php-pecl-zip              x86_64   1.15.4-1.el7.remi.7.2    remi-php72    51 k
Installing for dependencies:
 fontconfig                x86_64   2.10.95-11.el7           base         229 k
 fontpackages-filesystem   noarch   1.44-8.el7               base         9.9 k
 freetype                  x86_64   2.4.11-15.el7            base         392 k
 gd-last                   x86_64   2.2.5-5.el7.remi         remi-safe    134 k
 jbigkit-libs              x86_64   2.0-11.el7               base          46 k
 libX11                    x86_64   1.6.5-1.el7              base         606 k
 libX11-common             noarch   1.6.5-1.el7              base         164 k
 libXau                    x86_64   1.0.8-2.1.el7            base          29 k
 libXpm                    x86_64   3.5.12-1.el7             base          55 k
 libargon2                 x86_64   20161029-2.el7           epel          23 k
 libjpeg-turbo             x86_64   1.2.90-5.el7             base         134 k
 libmcrypt                 x86_64   2.5.8-13.el7             epel          99 k
 libpng                    x86_64   2:1.5.13-7.el7_2         base         213 k
 libtiff                   x86_64   4.0.3-27.el7_3           base         170 k
 libwebp                   x86_64   0.3.0-7.el7              base         170 k
 libxcb                    x86_64   1.12-1.el7               base         211 k
 libzip5                   x86_64   1.5.1-1.el7.remi         remi-safe     55 k
 lyx-fonts                 noarch   2.2.3-1.el7              epel         159 k
 php-json                  x86_64   7.2.11-1.el7.remi        remi-php72    62 k
 php-pdo                   x86_64   7.2.11-1.el7.remi        remi-php72   125 k

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

Total download size: 13 M
Installed size: 47 M
Is this ok [y/d/N]: y
Downloading packages:
(1/28): fontconfig-2.10.95-11.el7.x86_64.rpm               | 229 kB   00:00
(2/28): fontpackages-filesystem-1.44-8.el7.noarch.rpm      | 9.9 kB   00:00
warning: /var/cache/yum/x86_64/7/remi-safe/packages/gd-last-2.2.5-5.el7.remi.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Public key for gd-last-2.2.5-5.el7.remi.x86_64.rpm is not installed
(3/28): gd-last-2.2.5-5.el7.remi.x86_64.rpm                | 134 kB   00:00
(4/28): libX11-1.6.5-1.el7.x86_64.rpm                      | 606 kB   00:00
(5/28): jbigkit-libs-2.0-11.el7.x86_64.rpm                 |  46 kB   00:00
(6/28): libXau-1.0.8-2.1.el7.x86_64.rpm                    |  29 kB   00:00
(7/28): freetype-2.4.11-15.el7.x86_64.rpm                  | 392 kB   00:00
(8/28): libX11-common-1.6.5-1.el7.noarch.rpm               | 164 kB   00:00
(9/28): libXpm-3.5.12-1.el7.x86_64.rpm                     |  55 kB   00:00
(10/28): libjpeg-turbo-1.2.90-5.el7.x86_64.rpm             | 134 kB   00:00
warning: /var/cache/yum/x86_64/7/epel/packages/libargon2-20161029-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for libargon2-20161029-2.el7.x86_64.rpm is not installed
(11/28): libargon2-20161029-2.el7.x86_64.rpm               |  23 kB   00:00
(12/28): libpng-1.5.13-7.el7_2.x86_64.rpm                  | 213 kB   00:00
(13/28): libmcrypt-2.5.8-13.el7.x86_64.rpm                 |  99 kB   00:00
(14/28): libzip5-1.5.1-1.el7.remi.x86_64.rpm               |  55 kB   00:00
(15/28): lyx-fonts-2.2.3-1.el7.noarch.rpm                  | 159 kB   00:00
(16/28): libtiff-4.0.3-27.el7_3.x86_64.rpm                 | 170 kB   00:00
Public key for php-7.2.11-1.el7.remi.x86_64.rpm is not installed MB   --:-- ETA
(17/28): php-7.2.11-1.el7.remi.x86_64.rpm                  | 3.2 MB   00:00
(18/28): libwebp-0.3.0-7.el7.x86_64.rpm                    | 170 kB   00:00
(19/28): libxcb-1.12-1.el7.x86_64.rpm                      | 211 kB   00:00
(20/28): php-common-7.2.11-1.el7.remi.x86_64.rpm           | 1.1 MB   00:00
(21/28): php-gd-7.2.11-1.el7.remi.x86_64.rpm               |  77 kB   00:00
(22/28): php-json-7.2.11-1.el7.remi.x86_64.rpm             |  62 kB   00:00
(23/28): php-ldap-7.2.11-1.el7.remi.x86_64.rpm             |  69 kB   00:00
(24/28): php-mysqlnd-7.2.11-1.el7.remi.x86_64.rpm          | 232 kB   00:00
(25/28): php-pdo-7.2.11-1.el7.remi.x86_64.rpm              | 125 kB   00:00
(26/28): php-pecl-mcrypt-1.0.1-6.el7.remi.7.2.x86_64.rpm   |  29 kB   00:00
(27/28): php-pecl-zip-1.15.4-1.el7.remi.7.2.x86_64.rpm     |  51 kB   00:00
(28/28): php-cli-7.2.11-1.el7.remi.x86_64.rpm              | 4.8 MB   00:00
--------------------------------------------------------------------------------
Total                                              6.5 MB/s |  13 MB  00:01
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.5-2.el7.remi.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Is this ok [y/N]: y
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : freetype-2.4.11-15.el7.x86_64                               1/28
  Installing : libjpeg-turbo-1.2.90-5.el7.x86_64                           2/28
  Installing : libargon2-20161029-2.el7.x86_64                             3/28
  Installing : fontpackages-filesystem-1.44-8.el7.noarch                   4/28
  Installing : 2:libpng-1.5.13-7.el7_2.x86_64                              5/28
  Installing : lyx-fonts-2.2.3-1.el7.noarch                                6/28
  Installing : fontconfig-2.10.95-11.el7.x86_64                            7/28
  Installing : php-common-7.2.11-1.el7.remi.x86_64                         8/28
  Installing : php-json-7.2.11-1.el7.remi.x86_64                           9/28
  Installing : php-pdo-7.2.11-1.el7.remi.x86_64                           10/28
  Installing : php-cli-7.2.11-1.el7.remi.x86_64                           11/28
  Installing : libXau-1.0.8-2.1.el7.x86_64                                12/28
  Installing : libxcb-1.12-1.el7.x86_64                                   13/28
  Installing : jbigkit-libs-2.0-11.el7.x86_64                             14/28
  Installing : libtiff-4.0.3-27.el7_3.x86_64                              15/28
  Installing : libwebp-0.3.0-7.el7.x86_64                                 16/28
  Installing : libX11-common-1.6.5-1.el7.noarch                           17/28
  Installing : libX11-1.6.5-1.el7.x86_64                                  18/28
  Installing : libXpm-3.5.12-1.el7.x86_64                                 19/28
  Installing : gd-last-2.2.5-5.el7.remi.x86_64                            20/28
  Installing : libmcrypt-2.5.8-13.el7.x86_64                              21/28
  Installing : libzip5-1.5.1-1.el7.remi.x86_64                            22/28
  Installing : php-pecl-zip-1.15.4-1.el7.remi.7.2.x86_64                  23/28
  Installing : php-pecl-mcrypt-1.0.1-6.el7.remi.7.2.x86_64                24/28
  Installing : php-gd-7.2.11-1.el7.remi.x86_64                            25/28
  Installing : php-7.2.11-1.el7.remi.x86_64                               26/28
  Installing : php-mysqlnd-7.2.11-1.el7.remi.x86_64                       27/28
  Installing : php-ldap-7.2.11-1.el7.remi.x86_64                          28/28
  Verifying  : php-mysqlnd-7.2.11-1.el7.remi.x86_64                        1/28
  Verifying  : libX11-1.6.5-1.el7.x86_64                                   2/28
  Verifying  : lyx-fonts-2.2.3-1.el7.noarch                                3/28
  Verifying  : libtiff-4.0.3-27.el7_3.x86_64                               4/28
  Verifying  : php-json-7.2.11-1.el7.remi.x86_64                           5/28
  Verifying  : libjpeg-turbo-1.2.90-5.el7.x86_64                           6/28
  Verifying  : libzip5-1.5.1-1.el7.remi.x86_64                             7/28
  Verifying  : 2:libpng-1.5.13-7.el7_2.x86_64                              8/28
  Verifying  : freetype-2.4.11-15.el7.x86_64                               9/28
  Verifying  : libmcrypt-2.5.8-13.el7.x86_64                              10/28
  Verifying  : fontpackages-filesystem-1.44-8.el7.noarch                  11/28
  Verifying  : php-ldap-7.2.11-1.el7.remi.x86_64                          12/28
  Verifying  : php-pdo-7.2.11-1.el7.remi.x86_64                           13/28
  Verifying  : libX11-common-1.6.5-1.el7.noarch                           14/28
  Verifying  : php-pecl-zip-1.15.4-1.el7.remi.7.2.x86_64                  15/28
  Verifying  : libXpm-3.5.12-1.el7.x86_64                                 16/28
  Verifying  : libwebp-0.3.0-7.el7.x86_64                                 17/28
  Verifying  : libxcb-1.12-1.el7.x86_64                                   18/28
  Verifying  : libargon2-20161029-2.el7.x86_64                            19/28
  Verifying  : php-7.2.11-1.el7.remi.x86_64                               20/28
  Verifying  : jbigkit-libs-2.0-11.el7.x86_64                             21/28
  Verifying  : php-pecl-mcrypt-1.0.1-6.el7.remi.7.2.x86_64                22/28
  Verifying  : libXau-1.0.8-2.1.el7.x86_64                                23/28
  Verifying  : gd-last-2.2.5-5.el7.remi.x86_64                            24/28
  Verifying  : fontconfig-2.10.95-11.el7.x86_64                           25/28
  Verifying  : php-gd-7.2.11-1.el7.remi.x86_64                            26/28
  Verifying  : php-cli-7.2.11-1.el7.remi.x86_64                           27/28
  Verifying  : php-common-7.2.11-1.el7.remi.x86_64                        28/28

Installed:
  php.x86_64 0:7.2.11-1.el7.remi
  php-cli.x86_64 0:7.2.11-1.el7.remi
  php-common.x86_64 0:7.2.11-1.el7.remi
  php-gd.x86_64 0:7.2.11-1.el7.remi
  php-ldap.x86_64 0:7.2.11-1.el7.remi
  php-mysqlnd.x86_64 0:7.2.11-1.el7.remi
  php-pecl-mcrypt.x86_64 0:1.0.1-6.el7.remi.7.2
  php-pecl-zip.x86_64 0:1.15.4-1.el7.remi.7.2

Dependency Installed:
  fontconfig.x86_64 0:2.10.95-11.el7
  fontpackages-filesystem.noarch 0:1.44-8.el7
  freetype.x86_64 0:2.4.11-15.el7
  gd-last.x86_64 0:2.2.5-5.el7.remi
  jbigkit-libs.x86_64 0:2.0-11.el7
  libX11.x86_64 0:1.6.5-1.el7
  libX11-common.noarch 0:1.6.5-1.el7
  libXau.x86_64 0:1.0.8-2.1.el7
  libXpm.x86_64 0:3.5.12-1.el7
  libargon2.x86_64 0:20161029-2.el7
  libjpeg-turbo.x86_64 0:1.2.90-5.el7
  libmcrypt.x86_64 0:2.5.8-13.el7
  libpng.x86_64 2:1.5.13-7.el7_2
  libtiff.x86_64 0:4.0.3-27.el7_3
  libwebp.x86_64 0:0.3.0-7.el7
  libxcb.x86_64 0:1.12-1.el7
  libzip5.x86_64 0:1.5.1-1.el7.remi
  lyx-fonts.noarch 0:2.2.3-1.el7
  php-json.x86_64 0:7.2.11-1.el7.remi
  php-pdo.x86_64 0:7.2.11-1.el7.remi

Complete!
[root@avege ~]#

Затем проверьте установленную версию PHP на вашей системе.

php -v

Узнать версию PHP - команда php -v

root@avege ~

Using username "root".
root@88.212.253.127's password:
Send automatic password

[root@avege ~]# php -v

PHP 7.2.11 (cli) (built: Oct 10 2018 10:00:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
[root@avege ~]#

Перезапустите сервер, используя скрипт управления apachectl.

apachectl restart

root@avege ~

     
Using username "root".
root@88.212.253.127's password:
Send automatic password
[root@avege ~]#  apachectl restart
[root@avege ~]#

Вся информация о PHP — настройках компиляции, расширениях, сервере и среде выполнения, окружении PHP, об основных и локальных настройках конфигурации, HTTP-заголовках, версии.

php -i

Получить информации о версии PHP на VPS сервере и о параметрах, необходимо ввести команду: php -i

root@avege ~

Using username "root".
root@88.212.253.127's password:
Send automatic password

[root@avege ~]#  php -i
phpinfo()
PHP Version => 7.2.12

System => Linux avege 2.6.32-042stab134.3 #1 SMP Sun Oct 14 12:26:01 MSK 2018 x86_64
Build Date => Nov  6 2018 16:39:47
Server API => Command Line Interface
Virtual Directory Support => disabled
...
...
...
This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.12, Copyright (c) 1999-2018, by Zend Technologies
 _______________________________________________________________________

Configuration
BZip2 Support => Enabled
Stream Wrapper support => compress.bzip2://
Stream Filter support => bzip2.decompress, bzip2.compress
BZip2 Version => 1.0.6, 6-Sept-2010

calendar
Calendar support => enabled

Core
PHP Version => 7.2.12

html_errors => Off => Off
...
...
...
zend.signal_check => Off => Off

date
date/time support => enabled
timelib version => 2017.08
...
...
...

PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file:  LICENSE

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.

[root@avege ~]#

Можно получить ту же информацию создав файл с именем phpinfo.php, поместив в него код:

Страница, содержащая код PHP, должна иметь расширение  —  php.

<?php phpinfo(); ?>

Откройте файл phpinfo.php в браузере. После просмотра удалите этот файл, так как информация из него может быль использована злоумышленниками.


Важно отметить:
Если вы хотите, по той или иной причине, понизить версию PHP, нужно будет удалить существующие версии PHP, а затем установить новую версию PHP с необходимыми вами модулями.
Вы также можете установить на Linux несколько версий PHP и вручную выбрать, какую версию использовать по умолчанию.
Затем дважды проверьте установленную версию PHP на вашей системе.