CentOS7系统搭建LAMP及更新PHP版本操作详解

这篇文章主要介绍了CentOS7系统搭建LAMP及更新PHP版本操作,总结分析了CentOS7系统搭建LAMP及更新PHP版本操作相关原理、步骤、操作命令与注意事项,需要的朋友可以参考下。

本文实例讲述了CentOS7系统搭建LAMP及更新PHP版本操作,分享给大家供大家参考,具体如下:

搭建LAMP环境 用yum安装

安装Apache

安装Apache

[root@localhost /]# yum install httpd httpd-devel

启动Apache

[root@localhost /]# systemctl start httpd

设置Apache开机启动

[root@localhost /]# systemctl enable httpd

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

查看Apache状态

  1. [root@localhost /]# systemctl status httpd
  2. ● httpd.service - The Apache HTTP Server
  3. Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  4. Active: active (running) since 五 2017-07-21 17:21:37 CST; 6min ago
  5. Docs: man:httpd(8)
  6. man:apachectl(8)
  7. Main PID: 2449 (httpd)
  8. Status: "Total requests: 11; Current requests/sec: 0; Current traffic: 0 B/sec"
  9. CGroup: /system.slice/httpd.service
  10. ├─2449 /usr/sbin/httpd -DFOREGROUND
  11. ├─2450 /usr/sbin/httpd -DFOREGROUND
  12. ├─2451 /usr/sbin/httpd -DFOREGROUND
  13. ├─2452 /usr/sbin/httpd -DFOREGROUND
  14. ├─2453 /usr/sbin/httpd -DFOREGROUND
  15. ├─2454 /usr/sbin/httpd -DFOREGROUND
  16. ├─2493 /usr/sbin/httpd -DFOREGROUND
  17. ├─2494 /usr/sbin/httpd -DFOREGROUND
  18. └─2495 /usr/sbin/httpd -DFOREGROUND
  19. 7月 21 17:21:35 nmserver-7.test.com systemd[1]: Starting The Apache HTTP Server...
  20. 7月 21 17:21:36 nmserver-7.test.com httpd[2449]: AH00558: httpd: Could not reliably determine the server's fully q...ssage
  21. 7月 21 17:21:37 nmserver-7.test.com systemd[1]: Started The Apache HTTP Server.
  22. Hint: Some lines were ellipsized, use -l to show in full.

防火墙开启80端口, 依此执行以下命令

  1. [root@localhost /]# firewall-cmd --permanent --zone=public --add-service=http
  2. success
  3. [root@localhost /]# firewall-cmd --permanent --zone=public --add-service=https
  4. success
  5. [root@localhost /]# firewall-cmd --reload
  6. success

查看80端口监听状态

  1. [root@localhost /]# netstat -tulp
  2. Active Internet connections (only servers)
  3. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  4. tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN 1084/sshd
  5. tcp 0 0 localhost:smtp 0.0.0.0:* LISTEN 1486/master
  6. tcp6 0 0 [::]:ssh [::]:* LISTEN 1084/sshd
  7. tcp6 0 0 localhost:smtp [::]:* LISTEN 1486/master
  8. tcp6 0 0 [::]:http [::]:* LISTEN 2449/httpd
  9. udp 0 0 localhost:323 0.0.0.0:* 592/chronyd
  10. udp6 0 0 localhost:323 [::]:* 592/chronyd

查看服务器IP

  1. [root@localhost /]# ip addr
  2. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
  3. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  4. inet 127.0.0.1/8 scope host lo
  5. valid_lft forever preferred_lft forever
  6. inet6 ::1/128 scope host
  7. valid_lft forever preferred_lft forever
  8. 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
  9. link/ether 00:0c:29:56:bc:cf brd ff:ff:ff:ff:ff:ff
  10. inet 192.168.5.133/24 brd 192.168.8.255 scope global ens33
  11. valid_lft forever preferred_lft forever
  12. inet6 fe80::20c:29ff:fe56:bccf/64 scope link
  13. valid_lft forever preferred_lft forever
  14. 3: bridge0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
  15. link/ether ea:89:d5:c7:32:73 brd ff:ff:ff:ff:ff:ff

浏览器登陆查看

CentOS7系统搭建LAMP及更新PHP版本操作详解

安装mysql

  1. [root@localhost /]# yum install mariadb mariadb-server mariadb-libs mariadb-devel
  2. [root@localhost /]# rpm -qa |grep maria
  3. mariadb-libs-5.5.52-1.el7.i686
  4. mariadb-5.5.52-1.el7.i686
  5. mariadb-server-5.5.52-1.el7.i686
  6. mariadb-devel-5.5.52-1.el7.i686

开启Mysql,并设置开机启动,检查状态

  1. [root@localhost /]# systemctl start mariadb
  2. [root@localhost /]# systemctl enable mariadb
  3. Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
  4. [root@localhost /]# systemctl status mariadb
  5. ● mariadb.service - MariaDB database server
  6. Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  7. Active: active (running) since 六 2017-07-22 21:19:20 CST; 21s ago
  8. Main PID: 9603 (mysqld_safe)
  9. CGroup: /system.slice/mariadb.service
  10. ├─9603 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
  11. └─9760 /usr/libexec/mysqld --basedir=/usr --datadir=/v...
  12. 7月 22 21:19:15 nmserver-7.test.com mariadb-prepare-db-dir[9524]: ...
  13. 7月 22 21:19:15 nmserver-7.test.com mariadb-prepare-db-dir[9524]: ...
  14. 7月 22 21:19:15 nmserver-7.test.com mariadb-prepare-db-dir[9524]: ...
  15. 7月 22 21:19:15 nmserver-7.test.com mariadb-prepare-db-dir[9524]: ...
  16. 7月 22 21:19:15 nmserver-7.test.com mariadb-prepare-db-dir[9524]: ...
  17. 7月 22 21:19:15 nmserver-7.test.com mariadb-prepare-db-dir[9524]: ...
  18. 7月 22 21:19:15 nmserver-7.test.com mariadb-prepare-db-dir[9524]: ...
  19. 7月 22 21:19:16 nmserver-7.test.com mysqld_safe[9603]: 170722 21...
  20. 7月 22 21:19:16 nmserver-7.test.com mysqld_safe[9603]: 170722 21...
  21. 7月 22 21:19:20 nmserver-7.test.com systemd[1]: Started MariaDB ...

查看监听状态

  1. [root@localhost /]# netstat -tulp
  2. Active Internet connections (only servers)
  3. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  4. tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN 1084/sshd
  5. tcp 0 0 0.0.0.0:mysql 0.0.0.0:* LISTEN 9760/mysqld
  6. tcp6 0 0 [::]:ssh [::]:* LISTEN 1084/sshd
  7. tcp6 0 0 [::]:http [::]:* LISTEN 2449/httpd
  8. udp 0 0 localhost:323 0.0.0.0:* 592/chronyd
  9. udp6 0 0 localhost:323 [::]:* 592/chronyd

数据库安全设置

  1. [root@localhost /]# mysql_secure_installation
  2. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
  3. SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
  4. In order to log into MariaDB to secure it, we'll need the current
  5. password for the root user. If you've just installed MariaDB, and
  6. you haven't set the root password yet, the password will be blank,
  7. so you should just press enter here.
  8. Enter current password for root (enter for none):
  9. OK, successfully used password, moving on...
  10. Setting the root password ensures that nobody can log into the MariaDB
  11. root user without the proper authorisation.
  12. Set root password? [Y/n] y
  13. New password:
  14. Re-enter new password:
  15. Password updated successfully!
  16. Reloading privilege tables..
  17. ... Success!
  18. By default, a MariaDB installation has an anonymous user, allowing anyone
  19. to log into MariaDB without having to have a user account created for
  20. them. This is intended only for testing, and to make the installation
  21. go a bit smoother. You should remove them before moving into a
  22. production environment.
  23. Remove anonymous users? [Y/n] y
  24. ... Success!
  25. Normally, root should only be allowed to connect from 'localhost'. This
  26. ensures that someone cannot guess at the root password from the network.
  27. Disallow root login remotely? [Y/n] n
  28. ... skipping.
  29. By default, MariaDB comes with a database named 'test' that anyone can
  30. access. This is also intended only for testing, and should be removed
  31. before moving into a production environment.
  32. Remove test database and access to it? [Y/n] y
  33. - Dropping test database...
  34. ... Success!
  35. - Removing privileges on test database...
  36. ... Success!
  37. Reloading the privilege tables will ensure that all changes made so far
  38. will take effect immediately.
  39. Reload privilege tables now? [Y/n] y
  40. ... Success!
  41. Cleaning up...
  42. All done! If you've completed all of the above steps, your MariaDB
  43. installation should now be secure.
  44. Thanks for using MariaDB!

登陆数据库测试

  1. [root@localhost /]# mysql -uroot -p
  2. Enter password:
  3. Welcome to the MariaDB monitor. Commands end with ; or \g.
  4. Your MariaDB connection id is 11
  5. Server version: 5.5.52-MariaDB MariaDB Server
  6. Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
  7. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  8. MariaDB [(none)]> show databases;
  9. +--------------------+
  10. | Database |
  11. +--------------------+
  12. | information_schema |
  13. | mysql |
  14. | performance_schema |
  15. +--------------------+
  16. 3 rows in set (0.02 sec)
  17. MariaDB [(none)]>

安装PHP

安装PHP

  1. [root@localhost /]# yum -y install php
  2. [root@localhost /]# rpm -ql php
  3. /etc/httpd/conf.d/php.conf
  4. /etc/httpd/conf.modules.d/10-php.conf
  5. /usr/lib/httpd/modules/libphp5.so
  6. /usr/share/httpd/icons/php.gif
  7. /var/lib/php/session

将php与mysql关联起来

  1. [root@localhost /]# yum install php-mysql
  2. [root@localhost /]# rpm -ql php-mysql
  3. /etc/php.d/mysql.ini
  4. /etc/php.d/mysqli.ini
  5. /etc/php.d/pdo_mysql.ini
  6. /usr/lib/php/modules/mysql.so
  7. /usr/lib/php/modules/mysqli.so
  8. /usr/lib/php/modules/pdo_mysql.so

安装常用PHP模块

[root@localhost /]# yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath

测试PHP

  1. [root@localhost /]# cd /var/www/html/
  2. [root@localhost /]# ls
  3. [root@localhost /]# pwd
  4. /var/www/html
  5. [root@localhost /]# vi info.php
  6. <?php
  7. phpinfo();
  8. ?>
  9. ~
  10. ~
  11. ~
  12. ~
  13. ~
  14. ~
  15. ~
  16. ~
  17. :wq

重启Apache

[root@localhost /]# systemctl restart httpd

测试PHP

CentOS7系统搭建LAMP及更新PHP版本操作详解

更新PHP版本

首先查看是否有老版本

[root@localhost /]# yum list installed | grep php

移除老版本

[root@localhost /]# yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64

由于linux的yum源不存在php7.x,所以我们要更改yum源:

[root@localhost /]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

[root@localhost /]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

查看yum源中有没有php7.x

  1. [root@localhost /]# yum search php7
  2. Loaded plugins: fastestmirror, langpacks
  3. Loading mirror speeds from cached hostfile
  4. epel/x86_64/metalink | 5.9 kB 00:00:00
  5. * base: mirrors.aliyun.com
  6. * epel: my.mirrors.thegigabit.com
  7. * extras: mirrors.cn99.com
  8. * updates: mirrors.163.com
  9. * webtatic: uk.repo.webtatic.com
  10. epel | 5.4 kB 00:00:00
  11. webtatic | 3.6 kB 00:00:00
  12. (1/5): epel/x86_64/group_gz | 90 kB 00:00:01
  13. (2/5): webtatic/x86_64/group_gz | 448 B 00:00:04
  14. (3/5): epel/x86_64/primary_db | 6.9 MB 00:00:06
  15. (4/5): epel/x86_64/updateinfo | 1.0 MB 00:00:10
  16. (5/5): webtatic/x86_64/primary_db | 232 kB 00:00:14
  17. ============================================================= N/S matched: php7 =============================================================
  18. mod_php71w.x86_64 : PHP module for the Apache HTTP Server
  19. mod_php72w.x86_64 : PHP module for the Apache HTTP Server
  20. php70w.x86_64 : PHP scripting language for creating dynamic web sites
  21. php70w-bcmath.x86_64 : A module for PHP applications for using the bcmath library
  22. php70w-cli.x86_64 : Command-line interface for PHP
  23. php70w-common.x86_64 : Common files for PHP
  24. php70w-dba.x86_64 : A database abstraction layer module for PHP applications
  25. php70w-devel.x86_64 : Files needed for building PHP extensions
  26. php70w-embedded.x86_64 : PHP library for embedding in applications
  27. php70w-enchant.x86_64 : Enchant spelling extension for PHP applications
  28. php70w-fpm.x86_64 : PHP FastCGI Process Manager
  29. php70w-gd.x86_64 : A module for PHP applications for using the gd graphics library
  30. php70w-imap.x86_64 : A module for PHP applications that use IMAP
  31. php70w-interbase.x86_64 : A module for PHP applications that use Interbase/Firebird databases
  32. php70w-intl.x86_64 : Internationalization extension for PHP applications
  33. php70w-ldap.x86_64 : A module for PHP applications that use LDAP
  34. php70w-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
  35. php70w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
  36. php70w-mysql.x86_64 : A module for PHP applications that use MySQL databases
  37. php70w-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
  38. php70w-odbc.x86_64 : A module for PHP applications that use ODBC databases
  39. php70w-opcache.x86_64 : An opcode cache Zend extension
  40. php70w-pdo.x86_64 : A database access abstraction module for PHP applications
  41. php70w-pdo_dblib.x86_64 : MSSQL database module for PHP
  42. php70w-pear.noarch : PHP Extension and Application Repository framework
  43. php70w-pecl-apcu.x86_64 : APCu - APC User Cache
  44. php70w-pecl-apcu-devel.x86_64 : APCu developer files (header)
  45. php70w-pecl-geoip.x86_64 : Extension to map IP addresses to geographic places
  46. php70w-pecl-igbinary.x86_64 : Replacement for the standard PHP serializer
  47. php70w-pecl-igbinary-devel.x86_64 : Igbinary developer files (header)
  48. php70w-pecl-imagick.x86_64 : Provides a wrapper to the ImageMagick library
  49. php70w-pecl-imagick-devel.x86_64 : Imagick developer files (header)
  50. php70w-pecl-memcached.x86_64 : Extension to work with the Memcached caching daemon
  51. php70w-pecl-mongodb.x86_64 : PECL package MongoDB driver
  52. php70w-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
  53. php70w-pecl-xdebug.x86_64 : PECL package for debugging PHP scripts
  54. php70w-pgsql.x86_64 : A PostgreSQL database module for PHP
  55. php70w-phpdbg.x86_64 : Interactive PHP debugger
  56. php70w-process.x86_64 : Modules for PHP script using system process interfaces
  57. php70w-pspell.x86_64 : A module for PHP applications for using pspell interfaces
  58. php70w-recode.x86_64 : A module for PHP applications for using the recode library
  59. php70w-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
  60. php70w-soap.x86_64 : A module for PHP applications that use the SOAP protocol
  61. php70w-tidy.x86_64 : Standard PHP module provides tidy library support
  62. php70w-xml.x86_64 : A module for PHP applications which use XML
  63. php70w-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
  64. php71w-bcmath.x86_64 : A module for PHP applications for using the bcmath library
  65. php71w-cli.x86_64 : Command-line interface for PHP
  66. php71w-common.x86_64 : Common files for PHP
  67. php71w-dba.x86_64 : A database abstraction layer module for PHP applications
  68. php71w-devel.x86_64 : Files needed for building PHP extensions
  69. php71w-embedded.x86_64 : PHP library for embedding in applications
  70. php71w-enchant.x86_64 : Enchant spelling extension for PHP applications
  71. php71w-fpm.x86_64 : PHP FastCGI Process Manager
  72. php71w-gd.x86_64 : A module for PHP applications for using the gd graphics library
  73. php71w-imap.x86_64 : A module for PHP applications that use IMAP
  74. php71w-interbase.x86_64 : A module for PHP applications that use Interbase/Firebird databases
  75. php71w-intl.x86_64 : Internationalization extension for PHP applications
  76. php71w-ldap.x86_64 : A module for PHP applications that use LDAP
  77. php71w-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
  78. php71w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
  79. php71w-mysql.x86_64 : A module for PHP applications that use MySQL databases
  80. php71w-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
  81. php71w-odbc.x86_64 : A module for PHP applications that use ODBC databases
  82. php71w-opcache.x86_64 : An opcode cache Zend extension
  83. php71w-pdo.x86_64 : A database access abstraction module for PHP applications
  84. php71w-pdo_dblib.x86_64 : MSSQL database module for PHP
  85. php71w-pear.noarch : PHP Extension and Application Repository framework
  86. php71w-pecl-apcu.x86_64 : APCu - APC User Cache
  87. php71w-pecl-apcu-devel.x86_64 : APCu developer files (header)
  88. php71w-pecl-geoip.x86_64 : Extension to map IP addresses to geographic places
  89. php71w-pecl-igbinary.x86_64 : Replacement for the standard PHP serializer
  90. php71w-pecl-igbinary-devel.x86_64 : Igbinary developer files (header)
  91. php71w-pecl-imagick.x86_64 : Provides a wrapper to the ImageMagick library
  92. php71w-pecl-imagick-devel.x86_64 : Imagick developer files (header)
  93. php71w-pecl-memcached.x86_64 : Extension to work with the Memcached caching daemon
  94. php71w-pecl-mongodb.x86_64 : PECL package MongoDB driver
  95. php71w-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
  96. php71w-pecl-xdebug.x86_64 : PECL package for debugging PHP scripts
  97. php71w-pgsql.x86_64 : A PostgreSQL database module for PHP
  98. php71w-phpdbg.x86_64 : Interactive PHP debugger
  99. php71w-process.x86_64 : Modules for PHP script using system process interfaces
  100. php71w-pspell.x86_64 : A module for PHP applications for using pspell interfaces
  101. php71w-recode.x86_64 : A module for PHP applications for using the recode library
  102. php71w-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
  103. php71w-soap.x86_64 : A module for PHP applications that use the SOAP protocol
  104. php71w-tidy.x86_64 : Standard PHP module provides tidy library support
  105. php71w-xml.x86_64 : A module for PHP applications which use XML
  106. php71w-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
  107. php72w-bcmath.x86_64 : A module for PHP applications for using the bcmath library
  108. php72w-cli.x86_64 : Command-line interface for PHP
  109. php72w-common.x86_64 : Common files for PHP
  110. php72w-dba.x86_64 : A database abstraction layer module for PHP applications
  111. php72w-devel.x86_64 : Files needed for building PHP extensions
  112. php72w-embedded.x86_64 : PHP library for embedding in applications
  113. php72w-enchant.x86_64 : Enchant spelling extension for PHP applications
  114. php72w-fpm.x86_64 : PHP FastCGI Process Manager
  115. php72w-gd.x86_64 : A module for PHP applications for using the gd graphics library
  116. php72w-imap.x86_64 : A module for PHP applications that use IMAP
  117. php72w-interbase.x86_64 : A module for PHP applications that use Interbase/Firebird databases
  118. php72w-intl.x86_64 : Internationalization extension for PHP applications
  119. php72w-ldap.x86_64 : A module for PHP applications that use LDAP
  120. php72w-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
  121. php72w-mysql.x86_64 : A module for PHP applications that use MySQL databases
  122. php72w-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
  123. php72w-odbc.x86_64 : A module for PHP applications that use ODBC databases
  124. php72w-opcache.x86_64 : An opcode cache Zend extension
  125. php72w-pdo.x86_64 : A database access abstraction module for PHP applications
  126. php72w-pdo_dblib.x86_64 : MSSQL database module for PHP
  127. php72w-pear.noarch : PHP Extension and Application Repository framework
  128. php72w-pecl-apcu.x86_64 : APCu - APC User Cache
  129. php72w-pecl-apcu-devel.x86_64 : APCu developer files (header)
  130. php72w-pecl-geoip.x86_64 : Extension to map IP addresses to geographic places
  131. php72w-pecl-igbinary.x86_64 : Replacement for the standard PHP serializer
  132. php72w-pecl-igbinary-devel.x86_64 : Igbinary developer files (header)
  133. php72w-pecl-imagick.x86_64 : Provides a wrapper to the ImageMagick library
  134. php72w-pecl-imagick-devel.x86_64 : Imagick developer files (header)
  135. php72w-pecl-libsodium.x86_64 : Wrapper for the Sodium cryptographic library
  136. php72w-pecl-memcached.x86_64 : Extension to work with the Memcached caching daemon
  137. php72w-pecl-mongodb.x86_64 : PECL package MongoDB driver
  138. php72w-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
  139. php72w-pecl-xdebug.x86_64 : PECL package for debugging PHP scripts
  140. php72w-pgsql.x86_64 : A PostgreSQL database module for PHP
  141. php72w-phpdbg.x86_64 : Interactive PHP debugger
  142. php72w-process.x86_64 : Modules for PHP script using system process interfaces
  143. php72w-pspell.x86_64 : A module for PHP applications for using pspell interfaces
  144. php72w-recode.x86_64 : A module for PHP applications for using the recode library
  145. php72w-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
  146. php72w-soap.x86_64 : A module for PHP applications that use the SOAP protocol
  147. php72w-sodium.x86_64 : Wrapper for the Sodium cryptographic library
  148. php72w-tidy.x86_64 : Standard PHP module provides tidy library support
  149. php72w-xml.x86_64 : A module for PHP applications which use XML
  150. php72w-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
  151. Name and summary matches only, use "search all" for everything.

yum 安装php72w和各种拓展,选自己需要的即可:

[root@localhost /]# yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-pear

完成安装 , 查看PHP版本

[root@localhost /]# php -v

重启服务器

[root@localhost /]# systemctl restart httpd

CentOS7系统搭建LAMP及更新PHP版本操作详解