lamp简介

定义:lamp架构就是Linux+Apache+MySQL/mariadb+php/Perl/python的一组动态网站或者服务器的开源软件
web服务器的工作流程
web服务器的资源分为两种,静态资源和动态资源
静态资源:就是指静态内容,客户端从服务器获得的资源的表现形式与原文件相同。可以简单的理解为就是直接存储于文件系统中的资源
动态资源:动态资源则通常是程序文件,需要在服务器执行之后,将执行的结果返回给客户端
在这里插入图片描述
①显示的是httpd服务器(即apache)和php服务器通过FastCGI协议进行通信,且php作为独立的服务进程运行
②显示的是php程序和mysql数据库间通过mysql协议进行通信。
httpd和php结合的方式有:

  1. modules:php将以httpd的扩展模块形式存在,需要加载动态资源时,httpd可以直接通过php模块来加工资源并返回给客户端
  2. CGI:httpd需要加载动态资源时,通过CGI与php解释器联系,获得php执行的结果,此时httpd负责与php连接的建立和断开等
  3. FastCGI:利用php-fpm机制,启动为服务进程,php自行运行为一个服务,https通过socket与php通信
    上述三种方法中 FastCGI更为常用

lamp平台构建

lamp安装顺序httpd–>mysql–>php
一、安装httpd

[root@localhost ~]# yum -y install httpd*
已加载插件:fastestmirror
Repository 'base': Error parsing config: Error parsing "baseurl = 'local'": URL must be http, ftp, file or https not ""
base                                              | 3.6 kB     00:00     
extras                                            | 2.9 kB     00:00     
updates                                           | 2.9 kB     00:00     
extras/7/x86_64/primary_db                          | 205 kB   00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-93.el7.centos 将被 安装
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-93.el7.centos.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-93.el7.centos.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-93.el7.centos.x86_64 需要
---> 软件包 httpd-devel.x86_64.0.2.4.6-93.el7.centos 将被 安装
--> 正在处理依赖关系 apr-util-devel,它被软件包 httpd-devel-2.4.6-93.el7.centos.x86_64 需要
--> 正在处理依赖关系 apr-devel,它被软件包 httpd-devel-2.4.6-93.el7.centos.x86_64 需要
---> 软件包 httpd-manual.noarch.0.2.4.6-93.el7.centos 将被 安装
---> 软件包 httpd-tools.x86_64.0.2.4.6-93.el7.centos 将被 安装
--> 正在检查事务
---> 软件包 apr.x86_64.0.1.4.8-5.el7 将被 安装
---> 软件包 apr-devel.x86_64.0.1.4.8-5.el7 将被 安装
---> 软件包 apr-util.x86_64.0.1.5.2-6.el7 将被 安装
---> 软件包 apr-util-devel.x86_64.0.1.5.2-6.el7 将被 安装
--> 正在处理依赖关系 openldap-devel(x86-64),它被软件包 apr-util-devel-1.5.2-6.el7.x86_64 需要
--> 正在处理依赖关系 libdb-devel(x86-64),它被软件包 apr-util-devel-1.5.2-6.el7.x86_64 需要
--> 正在处理依赖关系 expat-devel(x86-64),它被软件包 apr-util-devel-1.5.2-6.el7.x86_64 需要
---> 软件包 mailcap.noarch.0.2.1.41-2.el7 将被 安装
--> 正在检查事务
---> 软件包 expat-devel.x86_64.0.2.1.0-11.el7 将被 安装
--> 正在处理依赖关系 expat = 2.1.0-11.el7,它被软件包 expat-devel-2.1.0-11.el7.x86_64 需要
---> 软件包 libdb-devel.x86_64.0.5.3.21-25.el7 将被 安装
--> 正在处理依赖关系 libdb(x86-64) = 5.3.21-25.el7,它被软件包 libdb-devel-5.3.21-25.el7.x86_64 需要
---> 软件包 openldap-devel.x86_64.0.2.4.44-21.el7_6 将被 安装
--> 正在处理依赖关系 openldap(x86-64) = 2.4.44-21.el7_6,它被软件包 openldap-devel-2.4.44-21.el7_6.x86_64 需要
--> 正在处理依赖关系 cyrus-sasl-devel(x86-64),它被软件包 openldap-devel-2.4.44-21.el7_6.x86_64 需要
--> 正在检查事务
---> 软件包 cyrus-sasl-devel.x86_64.0.2.1.26-23.el7 将被 安装
--> 正在处理依赖关系 cyrus-sasl-lib(x86-64) = 2.1.26-23.el7,它被软件包 cyrus-sasl-devel-2.1.26-23.el7.x86_64 需要
--> 正在处理依赖关系 cyrus-sasl(x86-64) = 2.1.26-23.el7,它被软件包 cyrus-sasl-devel-2.1.26-23.el7.x86_64 需要
---> 软件包 expat.x86_64.0.2.1.0-8.el7 将被 升级
---> 软件包 expat.x86_64.0.2.1.0-11.el7 将被 更新
---> 软件包 libdb.x86_64.0.5.3.21-19.el7 将被 升级
--> 正在处理依赖关系 libdb(x86-64) = 5.3.21-19.el7,它被软件包 libdb-utils-5.3.21-19.el7.x86_64 需要
---> 软件包 libdb.x86_64.0.5.3.21-25.el7 将被 更新
---> 软件包 openldap.x86_64.0.2.4.40-13.el7 将被 升级
---> 软件包 openldap.x86_64.0.2.4.44-21.el7_6 将被 更新
--> 正在检查事务
---> 软件包 cyrus-sasl.x86_64.0.2.1.26-23.el7 将被 安装
---> 软件包 cyrus-sasl-lib.x86_64.0.2.1.26-20.el7_2 将被 升级
---> 软件包 cyrus-sasl-lib.x86_64.0.2.1.26-23.el7 将被 更新
---> 软件包 libdb-utils.x86_64.0.5.3.21-19.el7 将被 升级
---> 软件包 libdb-utils.x86_64.0.5.3.21-25.el7 将被 更新
--> 解决依赖关系完成
此处省略................
作为依赖被升级:
  cyrus-sasl-lib.x86_64 0:2.1.26-23.el7                                  
  expat.x86_64 0:2.1.0-11.el7                                            
  libdb.x86_64 0:5.3.21-25.el7                                           
  libdb-utils.x86_64 0:5.3.21-25.el7                                     
  openldap.x86_64 0:2.4.44-21.el7_6                                      

完毕!
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=http
success
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=https
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]# 
安装完毕后设置开机自启和放行防火墙

网站验证
在这里插入图片描述

二、安装mariadb(此时需要安装两个包,一个是mariadb还有一个是mariadb服务包)

①
[root@localhost ~]# yum -y install mariadb
已加载插件:fastestmirror
Repository 'base': Error parsing config: Error parsing "baseurl = 'local'": URL must be http, ftp, file or https not ""
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.65-1.el7 将被 安装
--> 正在处理依赖关系 mariadb-libs(x86-64) = 1:5.5.65-1.el7,它被软件包 1:mariadb-5.5.65-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.52-1.el7 将被 升级
---> 软件包 mariadb-libs.x86_64.1.5.5.65-1.el7 将被 更新
--> 解决依赖关系完成
此处省略...........
已安装:
  mariadb.x86_64 1:5.5.65-1.el7                                          

作为依赖被升级:
  mariadb-libs.x86_64 1:5.5.65-1.el7                                     

完毕!
②
[root@localhost ~]# yum -y install mariadb-server mariadb
已加载插件:fastestmirror
Repository 'base': Error parsing config: Error parsing "baseurl = 'local'": URL must be http, ftp, file or https not ""
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
软件包 1:mariadb-5.5.65-1.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb-server.x86_64.1.5.5.65-1.el7 将被 安装
--> 正在处理依赖关系 perl-DBI,它被软件包 1:mariadb-server-5.5.65-1.el7.x86_64 需要
--> 正在处理依赖关系 perl-DBD-MySQL,它被软件包 1:mariadb-server-5.5.65-1.el7.x86_64 需要
--> 正在处理依赖关系 perl(Data::Dumper),它被软件包 1:mariadb-server-5.5.65-1.el7.x86_64 需要
--> 正在处理依赖关系 perl(DBI),它被软件包 1:mariadb-server-5.5.65-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 perl-DBD-MySQL.x86_64.0.4.023-6.el7 将被 安装
---> 软件包 perl-DBI.x86_64.0.1.627-4.el7 将被 安装
--> 正在处理依赖关系 perl(RPC::PlServer) >= 0.2001,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在处理依赖关系 perl(RPC::PlClient) >= 0.2000,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
---> 软件包 perl-Data-Dumper.x86_64.0.2.145-3.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-PlRPC.noarch.0.0.2020-14.el7 将被 安装
--> 正在处理依赖关系 perl(Net::Daemon) >= 0.13,它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Test),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Log),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Zlib),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在检查事务
---> 软件包 perl-IO-Compress.noarch.0.2.061-2.el7 将被 安装
--> 正在处理依赖关系 perl(Compress::Raw::Zlib) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Raw::Bzip2) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
---> 软件包 perl-Net-Daemon.noarch.0.0.48-5.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Compress-Raw-Bzip2.x86_64.0.2.061-3.el7 将被 安装
---> 软件包 perl-Compress-Raw-Zlib.x86_64.1.2.061-4.el7 将被 安装
--> 解决依赖关系完成
此处省略.......
已安装:
  mariadb-server.x86_64 1:5.5.65-1.el7                                   

作为依赖被安装:
  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7                           
  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7                            
  perl-DBD-MySQL.x86_64 0:4.023-6.el7                                    
  perl-DBI.x86_64 0:1.627-4.el7                                          
  perl-Data-Dumper.x86_64 0:2.145-3.el7                                  
  perl-IO-Compress.noarch 0:2.061-2.el7                                  
  perl-Net-Daemon.noarch 0:0.48-5.el7                                    
  perl-PlRPC.noarch 0:0.2020-14.el7                                      

完毕!
[root@localhost ~]# systemctl start mariadb    设置开机自启
[root@localhost ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] 
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

三、安装php

①安装php
[root@localhost ~]# yum -y install php
已加载插件:fastestmirror
Repository 'base': Error parsing config: Error parsing "baseurl = 'local'": URL must be http, ftp, file or https not ""
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 php.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 php-common(x86-64) = 5.4.16-48.el7,它被软件包 php-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 php-cli(x86-64) = 5.4.16-48.el7,它被软件包 php-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libcrypto.so.10(OPENSSL_1.0.2)(64bit),它被软件包 php-5.4.16-48.el7.x86_64 需要
--> 正在检查事务
---> 软件包 openssl-libs.x86_64.1.1.0.1e-60.el7 将被 升级
--> 正在处理依赖关系 openssl-libs(x86-64) = 1:1.0.1e-60.el7,它被软件包 1:openssl-1.0.1e-60.el7.x86_64 需要
---> 软件包 openssl-libs.x86_64.1.1.0.2k-19.el7 将被 更新
---> 软件包 php-cli.x86_64.0.5.4.16-48.el7 将被 安装
---> 软件包 php-common.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 libzip.so.2()(64bit),它被软件包 php-common-5.4.16-48.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libzip.x86_64.0.0.10.1-8.el7 将被 安装
---> 软件包 openssl.x86_64.1.1.0.1e-60.el7 将被 升级
---> 软件包 openssl.x86_64.1.1.0.2k-19.el7 将被 更新
--> 解决依赖关系完成
此处省略..........
已安装:
  php.x86_64 0:5.4.16-48.el7                                             

作为依赖被安装:
  libzip.x86_64 0:0.10.1-8.el7         php-cli.x86_64 0:5.4.16-48.el7   
  php-common.x86_64 0:5.4.16-48.el7   

作为依赖被升级:
  openssl.x86_64 1:1.0.2k-19.el7   openssl-libs.x86_64 1:1.0.2k-19.el7  

完毕!
②安装php的相关组件
[root@localhost ~]# yum install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel -y
已加载插件:fastestmirror
Repository 'base': Error parsing config: Error parsing "baseurl = 'local'": URL must be http, ftp, file or https not ""
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 curl.x86_64.0.7.29.0-35.el7.centos 将被 升级
---> 软件包 curl.x86_64.0.7.29.0-57.el7 将被 更新
--> 正在处理依赖关系 libcurl = 7.29.0-57.el7,它被软件包 curl-7.29.0-57.el7.x86_64 需要
---> 软件包 libcurl-devel.x86_64.0.7.29.0-57.el7 将被 安装
---> 软件包 php-gd.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 libt1.so.5()(64bit),它被软件包 php-gd-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libXpm.so.4()(64bit),它被软件包 php-gd-5.4.16-48.el7.x86_64 需要
---> 软件包 php-ldap.x86_64.0.5.4.16-48.el7 将被 安装
---> 软件包 php-mbstring.x86_64.0.5.4.16-48.el7 将被 安装
---> 软件包 php-mysql.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 php-pdo(x86-64) = 5.4.16-48.el7,它被软件包 php-mysql-5.4.16-48.el7.x86_64 需要
---> 软件包 php-odbc.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 libodbc.so.2()(64bit),它被软件包 php-odbc-5.4.16-48.el7.x86_64 需要
---> 软件包 php-pear.noarch.1.1.9.4-21.el7 将被 安装
--> 正在处理依赖关系 php-posix,它被软件包 1:php-pear-1.9.4-21.el7.noarch 需要
---> 软件包 php-snmp.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 net-snmp,它被软件包 php-snmp-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libnetsnmp.so.31()(64bit),它被软件包 php-snmp-5.4.16-48.el7.x86_64 需要
---> 软件包 php-soap.x86_64.0.5.4.16-48.el7 将被 安装
---> 软件包 php-xml.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.24)(64bit),它被软件包 php-xml-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.22)(64bit),它被软件包 php-xml-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.18)(64bit),它被软件包 php-xml-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.13)(64bit),它被软件包 php-xml-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1(LIBXML2_1.0.11)(64bit),它被软件包 php-xml-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libxslt.so.1()(64bit),它被软件包 php-xml-5.4.16-48.el7.x86_64 需要
--> 正在处理依赖关系 libexslt.so.0()(64bit),它被软件包 php-xml-5.4.16-48.el7.x86_64 需要
---> 软件包 php-xmlrpc.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在检查事务
---> 软件包 libXpm.x86_64.0.3.5.12-1.el7 将被 安装
---> 软件包 libcurl.x86_64.0.7.29.0-35.el7.centos 将被 升级
---> 软件包 libcurl.x86_64.0.7.29.0-57.el7 将被 更新
--> 正在处理依赖关系 nss-pem(x86-64) >= 1.0.3-5,它被软件包 libcurl-7.29.0-57.el7.x86_64 需要
--> 正在处理依赖关系 libssh2(x86-64) >= 1.8.0,它被软件包 libcurl-7.29.0-57.el7.x86_64 需要
--> 正在处理依赖关系 libnss3.so(NSS_3.34)(64bit),它被软件包 libcurl-7.29.0-57.el7.x86_64 需要
---> 软件包 libxslt.x86_64.0.1.1.28-5.el7 将被 安装
---> 软件包 net-snmp.x86_64.1.5.7.2-48.el7_8.1 将被 安装
--> 正在处理依赖关系 net-snmp-agent-libs = 1:5.7.2-48.el7_8.1,它被软件包 1:net-snmp-5.7.2-48.el7_8.1.x86_64 需要
--> 正在处理依赖关系 libsensors.so.4()(64bit),它被软件包 1:net-snmp-5.7.2-48.el7_8.1.x86_64 需要
--> 正在处理依赖关系 libnetsnmptrapd.so.31()(64bit),它被软件包 1:net-snmp-5.7.2-48.el7_8.1.x86_64 需要
--> 正在处理依赖关系 libnetsnmpmibs.so.31()(64bit),它被软件包 1:net-snmp-5.7.2-48.el7_8.1.x86_64 需要
--> 正在处理依赖关系 libnetsnmpagent.so.31()(64bit),它被软件包 1:net-snmp-5.7.2-48.el7_8.1.x86_64 需要
---> 软件包 net-snmp-libs.x86_64.1.5.7.2-48.el7_8.1 将被 安装
---> 软件包 php-pdo.x86_64.0.5.4.16-48.el7 将被 安装
---> 软件包 php-process.x86_64.0.5.4.16-48.el7 将被 安装
---> 软件包 t1lib.x86_64.0.5.1.2-14.el7 将被 安装
---> 软件包 unixODBC.x86_64.0.2.3.1-14.el7 将被 安装
--> 正在处理依赖关系 libltdl.so.7()(64bit),它被软件包 unixODBC-2.3.1-14.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libssh2.x86_64.0.1.4.3-10.el7_2.1 将被 升级
---> 软件包 libssh2.x86_64.0.1.8.0-3.el7 将被 更新
---> 软件包 libtool-ltdl.x86_64.0.2.4.2-22.el7_3 将被 安装
---> 软件包 lm_sensors-libs.x86_64.0.3.4.0-8.20160601gitf9185e5.el7 将被 安装
---> 软件包 net-snmp-agent-libs.x86_64.1.5.7.2-48.el7_8.1 将被 安装
---> 软件包 nss.x86_64.0.3.21.0-17.el7 将被 升级
--> 正在处理依赖关系 nss = 3.21.0-17.el7,它被软件包 nss-sysinit-3.21.0-17.el7.x86_64 需要
--> 正在处理依赖关系 nss(x86-64) = 3.21.0-17.el7,它被软件包 nss-tools-3.21.0-17.el7.x86_64 需要
---> 软件包 nss.x86_64.0.3.44.0-7.el7_7 将被 更新
--> 正在处理依赖关系 nss-util >= 3.44.0-3,它被软件包 nss-3.44.0-7.el7_7.x86_64 需要
--> 正在处理依赖关系 nss-softokn(x86-64) >= 3.44.0-1,它被软件包 nss-3.44.0-7.el7_7.x86_64 需要
--> 正在处理依赖关系 nspr >= 4.21.0,它被软件包 nss-3.44.0-7.el7_7.x86_64 需要
--> 正在处理依赖关系 libnssutil3.so(NSSUTIL_3.39)(64bit),它被软件包 nss-3.44.0-7.el7_7.x86_64 需要
--> 正在处理依赖关系 libnssutil3.so(NSSUTIL_3.38)(64bit),它被软件包 nss-3.44.0-7.el7_7.x86_64 需要
--> 正在处理依赖关系 libnssutil3.so(NSSUTIL_3.31)(64bit),它被软件包 nss-3.44.0-7.el7_7.x86_64 需要
--> 正在处理依赖关系 libnssutil3.so(NSSUTIL_3.24)(64bit),它被软件包 nss-3.44.0-7.el7_7.x86_64 需要
---> 软件包 nss-pem.x86_64.0.1.0.3-7.el7 将被 安装
--> 正在检查事务
---> 软件包 nspr.x86_64.0.4.11.0-1.el7_2 将被 升级
---> 软件包 nspr.x86_64.0.4.21.0-1.el7 将被 更新
---> 软件包 nss-softokn.x86_64.0.3.16.2.3-14.4.el7 将被 升级
---> 软件包 nss-softokn.x86_64.0.3.44.0-8.el7_7 将被 更新
--> 正在处理依赖关系 nss-softokn-freebl(x86-64) >= 3.44.0-8.el7_7,它被软件包 nss-softokn-3.44.0-8.el7_7.x86_64 需要
---> 软件包 nss-sysinit.x86_64.0.3.21.0-17.el7 将被 升级
---> 软件包 nss-sysinit.x86_64.0.3.44.0-7.el7_7 将被 更新
---> 软件包 nss-tools.x86_64.0.3.21.0-17.el7 将被 升级
---> 软件包 nss-tools.x86_64.0.3.44.0-7.el7_7 将被 更新
---> 软件包 nss-util.x86_64.0.3.21.0-2.2.el7_2 将被 升级
---> 软件包 nss-util.x86_64.0.3.44.0-4.el7_7 将被 更新
--> 正在检查事务
---> 软件包 nss-softokn-freebl.x86_64.0.3.16.2.3-14.4.el7 将被 升级
---> 软件包 nss-softokn-freebl.x86_64.0.3.44.0-8.el7_7 将被 更新
--> 解决依赖关系完成
此处省略........
作为依赖被升级:
  libcurl.x86_64 0:7.29.0-57.el7                                         
  libssh2.x86_64 0:1.8.0-3.el7                                           
  nspr.x86_64 0:4.21.0-1.el7                                             
  nss.x86_64 0:3.44.0-7.el7_7                                            
  nss-softokn.x86_64 0:3.44.0-8.el7_7                                    
  nss-softokn-freebl.x86_64 0:3.44.0-8.el7_7                             
  nss-sysinit.x86_64 0:3.44.0-7.el7_7                                    
  nss-tools.x86_64 0:3.44.0-7.el7_7                                      
  nss-util.x86_64 0:3.44.0-4.el7_7                                       

完毕!
[root@localhost ~]# yum search php     查看安装的php组件
已加载插件:fastestmirror
Repository 'base': Error parsing config: Error parsing "baseurl = 'local'": URL must be http, ftp, file or https not ""
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cqu.edu.cn
 * updates: mirrors.cqu.edu.cn
=========================== N/S matched: php ============================
emacs-php-mode.noarch : Major GNU Emacs mode for editing PHP code
graphviz-php.x86_64 : PHP extension for graphviz
php.x86_64 : PHP scripting language for creating dynamic web sites
php-bcmath.x86_64 : A module for PHP applications for using the bcmath
                  : library
php-cli.x86_64 : Command-line interface for PHP
php-common.x86_64 : Common files for PHP
php-dba.x86_64 : A database abstraction layer module for PHP applications
php-devel.x86_64 : Files needed for building PHP extensions
php-embedded.x86_64 : PHP library for embedding in applications
php-enchant.x86_64 : Enchant spelling extension for PHP applications
php-fpm.x86_64 : PHP FastCGI Process Manager
php-gd.x86_64 : A module for PHP applications for using the gd graphics
              : library
php-intl.x86_64 : Internationalization extension for PHP applications
php-ldap.x86_64 : A module for PHP applications that use LDAP
php-mbstring.x86_64 : A module for PHP applications which need multi-byte
                    : string handling
php-mysql.x86_64 : A module for PHP applications that use MySQL databases
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL
                   : databases
php-odbc.x86_64 : A module for PHP applications that use ODBC databases
php-pdo.x86_64 : A database access abstraction module for PHP
               : applications
php-pear.noarch : PHP Extension and Application Repository framework
php-pgsql.x86_64 : A PostgreSQL database module for PHP
php-process.x86_64 : Modules for PHP script using system process
                   : interfaces
php-pspell.x86_64 : A module for PHP applications for using pspell
                  : interfaces
php-recode.x86_64 : A module for PHP applications for using the recode
                  : library
php-snmp.x86_64 : A module for PHP applications that query SNMP-managed
                : devices
php-soap.x86_64 : A module for PHP applications that use the SOAP
                : protocol
php-xml.x86_64 : A module for PHP applications which use XML
php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC
                  : protocol
rrdtool-php.x86_64 : PHP RRDtool bindings
uuid-php.x86_64 : PHP support for Universally Unique Identifier library
php-pecl-memcache.x86_64 : Extension to work with the Memcached caching
                         : daemon

  名称和简介匹配 only,使用“search all”试试。
[root@localhost ~]# vim /var/www/html/info.php 编辑测试页
[root@localhost ~]# cat /var/www/html/info.php
<?php
phpinfo();
?>
[root@localhost ~]# systemctl restart httpd
查看测试页

在这里插入图片描述

[root@localhost ~]# cd /var/www/html/
[root@localhost html]# ls
info.php
[root@localhost html]# rm -rf * 删除文件
[root@localhost html]# ls
[root@localhost html]# ls
[root@localhost html]# ls  上传新文件并查看
admin.php  config           favicon.ico  index.php   misc.php    search.php  uc_client
api        connect.php      forum.php    install     plugin.php  source      uc_server
api.php    crossdomain.xml  group.php    m           portal.php  static
archiver   data             home.php     member.php  robots.txt  template
*访问网站*

[root@localhost html]#
在这里插入图片描述

赋予权限并关闭防火墙
[root@localhost html]# chown -R apache.apache /var/www/html/
[root@localhost html]# cd
[root@localhost ~]# systemctl stop firewalld.service            
[root@localhost ~]# setenforce 0
刷新页面并查看

在这里插入图片描述
在这里插入图片描述
建议用普通用户,不然权限太大
在这里插入图片描述
此时失败,需要进入数据库进行授权
在这里插入图片描述

进入数据库添加以下内容
MariaDB [(none)]> grant all privileges on *.* to 'yangcan'@'192.168.175.100' identified by '123456' with grant option;
Query OK, 0 rows affected (0.00 sec)
安装成功

在这里插入图片描述
在这里插入图片描述

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐