源码部署LAMP架构

LAMP

文章目录

  • LAMP
    • 1. lamp简介
    • 2. web服务器工作流程
      • 2.1 cgi与fastcgi
      • 2.2 httpd与php结合的方式
      • 2.3 web工作流程
    • 3. LAMP平台构建
      • 3.1 安装httpd
      • 3.2 安装mysql
      • 3.3 安装php
      • 3.4 验证

1. lamp简介

有了前面学习的知识的铺垫,今天可以来学习下第一个常用的web架构了。

所谓lamp,其实就是由Linux+Apache+Mysql/MariaDB+Php/Perl/Python的一组动态网站或者服务器的开源软件,除Linux外其它各部件本身都是各自独立的程序,但是因为经常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。

LAMP指的是Linux(操作系统)、Apache(HTTP服务器)、MySQL(也指MariaDB,数据库软件)和PHP(有时也是指Perl或Python)的第一个字母,一般用来建立web应用平台。

2. web服务器工作流程

在说lamp架构平台的搭建前,我们先来了解下什么是CGI,什么是FastCGI,什么是…

web服务器的资源分为两种,静态资源和动态资源

  • 静态资源就是指静态内容,客户端从服务器获得的资源的表现形式与原文件相同。可以简单的理解为就是直接存储于文件系统中的资源
  • 动态资源则通常是程序文件,需要在服务器执行之后,将执行的结果返回给客户端

2.1 cgi与fastcgi

上图阶段①中提到了FastCGI,下面我们来了解下CGI与FastCGI。

CGI(Common Gateway Interface,通用网关接口),CGI是外部应用程序(CGI程序)与WEB服务器之间的接口标准,是在CGI程序和Web服务器之间传递信息的过程。CGI规范允许Web服务器执行外部程序,并将它们的输出发送给Web浏览器,CGI将web的一组简单的静态超媒体文档变成一个完整的新的交互式媒体。

FastCGI(Fast Common Gateway Interface)是CGI的改良版,CGI是通过启用一个解释器进程来处理每个请求,耗时且耗资源,而FastCGI则是通过master-worker形式来处理每个请求,即启动一个master主进程,然后根据配置启动几个worker进程,当请求进来时,master会从worker进程中选择一个去处理请求,这样就避免了重复的生成和杀死进程带来的频繁cpu上下文切换而导致耗时

2.2 httpd与php结合的方式

httpd与php结合的方式有以下三种:

  • modules:php将以httpd的扩展模块形式存在,需要加载动态资源时,httpd可以直接通过php模块来加工资源并返回给客户端
    • httpd prefork:libphp5.so(多进程模型的php)
    • httpd event or worker:libphp5-zts.so(线程模型的php)
  • CGI:httpd需要加载动态资源时,通过CGI与php解释器联系,获得php执行的结果,此时httpd负责与php连接的建立和断开等
  • FastCGI:利用php-fpm机制,启动为服务进程,php自行运行为一个服务,https通过socket与php通信

较于CGI方式,FastCGI更为常用,很少有人使用CGI方式来加载动态资源

2.3 web工作流程

通过上面的图说明一下web的工作流程:

  • 客户端通过http协议请求web服务器资源
  • web服务器收到请求后判断客户端请求的资源是静态资源或是动态资源
    • 若是静态资源则直接从本地文件系统取之返回给客户端。
    • 否则若为动态资源则通过FastCGI协议与php服务器联系,通过CGI程序的master进程调度worker进程来执行程序以获得客户端请求的动态资源,并将执行的结果通过FastCGI协议返回给httpd服务器,httpd服务器收到php的执行结果后将其封装为http响应报文响应给客户端。在执行程序获取动态资源时若需要获得数据库中的资源时,由Php服务器通过mysql协议与MySQL/MariaDB服务器交互,取之而后返回给httpd,httpd将从php服务器收到的执行结果封装成http响应报文响应给客户端。

3. LAMP平台构建

3.1 安装httpd

1.安装依赖包
[root@localhost ~]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ make vim
Complete!2.创建系统用户
[root@localhost ~]# useradd -r -M -s /sbin/nologin apache
[root@localhost ~]# id apache
uid=991(apache) gid=991(apache) groups=991(apache)3.下载软件包(官网下apache.org)
[root@localhost ~]# wget https://downloads.apache.org/apr/apr-1.7.4.tar.gz
[root@localhost ~]# wget https://downloads.apache.org/apr/apr-util-1.6.3.tar.gz
[root@localhost ~]# wget https://downloads.apache.org/httpd/httpd-2.4.58.tar.gz4.解压软件包
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.7.4.tar.gz  apr-util-1.6.3.tar.gz  httpd-2.4.58.tar.gz
[root@localhost ~]# tar xf apr-1.7.4.tar.gz 
[root@localhost ~]# tar xf apr-util-1.6.3.tar.gz 
[root@localhost ~]# tar xf httpd-2.4.58.tar.gz 
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.7.4  apr-1.7.4.tar.gz  apr-util-1.6.3  apr-util-1.6.3.tar.gz  httpd-2.4.58  httpd-2.4.58.tar.gz5.编译软件包
//apr-1.7.4
[root@localhost ~]# cd apr-1.7.4
[root@localhost apr-1.7.4]# ls
apr-config.in  apr.pc.in   buildconf         configure     encoding    libapr.dsp  Makefile.in   network_io     random        support     tools
apr.dep        apr.spec    build-outputs.mk  configure.in  file_io     libapr.mak  Makefile.win  NOTICE         README        tables      user
apr.dsp        atomic      CHANGES           docs          helpers     libapr.rc   memory        NWGNUmakefile  README.cmake  test
apr.dsw        build       CMakeLists.txt    dso           include     LICENSE     misc          passwd         shmem         threadproc
apr.mak        build.conf  config.layout     emacs-mode    libapr.dep  locks       mmap          poll           strings       time
[root@localhost apr-1.7.4]# vim configurecfgfile=${ofile}Ttrap "$RM \"$cfgfile\"; exit 1" 1 2 15# $RM "$cfgfile"          //注释这一行[root@localhost apr-1.7.4]# ./configure --prefix=/usr/local/apr
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/apr.h
config.status: creating build/apr_rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating apr-1-config
config.status: creating apr.pc
config.status: creating test/Makefile
config.status: creating test/internal/Makefile
config.status: creating include/arch/unix/apr_private.h
config.status: executing libtool commands
config.status: executing default commands
[root@localhost apr-1.7.4]# echo $?
0
[root@localhost apr-1.7.4]# ls    //是否生成makefile文件
apr-1-config   apr.mak    build             CMakeLists.txt  configure     encoding    libapr.dsp  locks         misc           passwd        shmem    threadproc
apr-config.in  apr.pc     build.conf        config.layout   configure.in  file_io     libapr.mak  Makefile      mmap           poll          strings  time
apr.dep        apr.pc.in  buildconf         config.log      docs          helpers     libapr.rc   Makefile.in   network_io     random        support  tools
apr.dsp        apr.spec   build-outputs.mk  config.nice     dso           include     libtool     Makefile.win  NOTICE         README        tables   user
apr.dsw        atomic     CHANGES           config.status   emacs-mode    libapr.dep  LICENSE     memory        NWGNUmakefile  README.cmake  test
[root@localhost apr-1.7.4]# make
[root@localhost apr-1.7.4]# echo $?
0
[root@localhost apr-1.7.4]# make install
[root@localhost apr-1.7.4]# echo $?
0//apr-util-1.6.3
[root@localhost ~]# cd apr-util-1.6.3
[root@localhost apr-util-1.6.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.3]# echo $?
0
[root@localhost apr-util-1.6.3]# make
[root@localhost apr-util-1.6.3]# echo $?
0
[root@localhost apr-util-1.6.3]# make install
[root@localhost apr-util-1.6.3]# echo $?
0//httpd-2.4.58
[root@localhost ~]# cd httpd-2.4.58
[root@localhost httpd-2.4.58]# ./configure --prefix=/usr/local/apache \
> --sysconfdir=/etc/httpd24 \          //指定配置文件的位置,也可以不要这
> --enable-so \                     //一行,默认就为/usr/local/apache/
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util/ \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork
configure: summary of build options:Server Version: 2.4.58Install prefix: /usr/local/apacheC compiler:     gccCFLAGS:          -g -O2  CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE  LDFLAGS:           LIBS:             C preprocessor: gcc -E
[root@localhost httpd-2.4.58]# echo $?
0
[root@localhost httpd-2.4.58]# make
make[4]: Leaving directory '/root/httpd-2.4.58/modules/mappers'
make[3]: Leaving directory '/root/httpd-2.4.58/modules/mappers'
make[2]: Leaving directory '/root/httpd-2.4.58/modules'
make[2]: Entering directory '/root/httpd-2.4.58/support'
make[2]: Leaving directory '/root/httpd-2.4.58/support'make[1]: Leaving directory '/root/httpd-2.4.58'
[root@localhost httpd-2.4.58]# echo $?
0
[root@localhost httpd-2.4.58]# make install
[root@localhost httpd-2.4.58]# echo $?
06.配置环境变量
[root@localhost ~]# cd /usr/local/apache
[root@localhost apache]# ls
bin  build  cgi-bin  error  htdocs  icons  include  logs  man  manual  modules
[root@localhost apache]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh
[root@localhost apache]# source /etc/profile.d/httpd.sh
[root@localhost apache]# which httpd
/usr/local/apache/bin/httpd[root@localhost apache]# ln -s /usr/local/apache/include/ /usr/include/apache
[root@localhost apache]# vim /etc/man_db.conf 
#
MANDATORY_MANPATH                       /usr/man
MANDATORY_MANPATH                       /usr/share/man
MANDATORY_MANPATH                       /usr/local/share/man
MANDATORY_MANPATH                       /usr/local/apache/man
#---------------------------------------------------------7.启动apache
//取消这一行注释
[root@localhost ~]# cd /etc/httpd24/            //进入配置文件存放位置
[root@localhost httpd24]# ls
extra  httpd.conf  magic  mime.types  original
[root@localhost httpd24]# vim httpd.conf        //编辑配置文件![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/822ee6c6b0f04afc8e041c34b5b4fbf3.png#pic_center)ServerName www.example.com:80
//启动
[root@localhost httpd24]# apachectl start
[root@localhost ~]# ss -antl
State              Recv-Q             Send-Q                           Local Address:Port                           Peer Address:Port             Process             
LISTEN             0                  128                                    0.0.0.0:22                                  0.0.0.0:*                                    
LISTEN             0                  511                                          *:80                                        *:*                                    
LISTEN             0                  128                                       [::]:22                                     [::]:*                                    8.设置开机自启
[root@localhost ~]# cd /usr/lib/systemd/system
[root@localhost system]# cp sshd.service httpd.service
[root@localhost system]# apachectl stop
[root@localhost system]# ss -antl
State              Recv-Q             Send-Q                           Local Address:Port                           Peer Address:Port             Process             
LISTEN             0                  128                                    0.0.0.0:22                                  0.0.0.0:*                                    
LISTEN             0                  128                                       [::]:22                                     [::]:*                                    
[root@localhost system]# vim httpd.service 
[root@localhost system]# cat httpd.service 
[Unit]
Description=httpd server daemon
After=network.target [Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecStop=/usr/local/apache/bin/apachectl stop
ExecReload=/bin/kill -HUP $MAINPID[Install]
WantedBy=multi-user.target
[root@localhost system]# systemctl daemon-reload
[root@localhost system]# systemctl status httpd
○ httpd.service - httpd server daemonLoaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled)Active: inactive (dead)
[root@localhost system]# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@localhost system]# systemctl status httpd
● httpd.service - httpd server daemonLoaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)Active: active (running) since Mon 2023-12-11 14:48:00 CST; 5s agoProcess: 222039 ExecStart=/usr/local/apache/bin/apachectl start (code=exited, status=0/SUCCESS)Main PID: 222042 (httpd)Tasks: 6 (limit: 100179)Memory: 5.4MCPU: 31msCGroup: /system.slice/httpd.service├─222042 /usr/local/apache/bin/httpd -k start├─222043 /usr/local/apache/bin/httpd -k start├─222044 /usr/local/apache/bin/httpd -k start├─222045 /usr/local/apache/bin/httpd -k start├─222046 /usr/local/apache/bin/httpd -k start└─222047 /usr/local/apache/bin/httpd -k startDec 11 14:47:59 localhost.localdomain systemd[1]: Starting httpd server daemon...
Dec 11 14:48:00 localhost.localdomain systemd[1]: Started httpd server daemon.
[root@localhost system]# ss -antl
State              Recv-Q             Send-Q                           Local Address:Port                           Peer Address:Port             Process             
LISTEN             0                  128                                    0.0.0.0:22                                  0.0.0.0:*                                    
LISTEN             0                  511                                          *:80                                        *:*                                    
LISTEN             0                  128                                       [::]:22                                     [::]:*                                    

3.2 安装mysql

1.安装依赖包
//mariadb-devel要到pkgs.org上面找这个软件包默认是没有的
[root@localhost ~]# yum -y install https://mirror.stream.centos.org/9-stream/CRB/x86_64/os/Packages/mariadb-devel-10.5.16-2.el9.x86_64.rpm[root@localhost ~]# yum -y install ncurses-devel openssl-devel openssl cmake
Complete!2.创建系统用户
[root@localhost ~]# useradd -r -M -s /sbin/nologin mysql
[root@localhost ~]# id mysql
uid=990(mysql) gid=990(mysql) groups=990(mysql)3.下载软件包(官网下:mysql.com,下了之后上传)
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.7.4  apr-1.7.4.tar.gz  apr-util-1.6.3  apr-util-1.6.3.tar.gz  httpd-2.4.58  httpd-2.4.58.tar.gz  mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz4.解压软件包
[root@localhost ~]# tar xf mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz -C /usr/local
[root@localhost ~]# cd /usr/local
[root@localhost local]# ls
apache  apr  apr-util  bin  etc  games  include  lib  lib64  libexec  mysql-8.0.35-linux-glibc2.28-x86_64  sbin  share  src
[root@localhost local]# mv mysql-8.0.35-linux-glibc2.28-x86_64 mysql
[root@localhost local]# ls
apache  apr  apr-util  bin  etc  games  include  lib  lib64  libexec  mysql  sbin  share  src5.配置环境变量
[root@localhost local]# cd mysql
[root@localhost mysql]# ls
bin  docs  include  lib  LICENSE  man  README  share  support-files
[root@localhost mysql]# echo 'PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@localhost mysql]# source /etc/profile.d/mysql.sh
[root@localhost mysql]# which mysql
/usr/local/mysql/bin/mysql//有include的情况下做软连接
[root@localhost mysql]# ln -s /usr/local/mysql/include/ /usr/include/mysql///有lib的情况下编辑文件读取lib库
[root@localhost mysql]# vim /etc/ld.so.conf.d/mysql.conf
[root@localhost mysql]# cat /etc/ld.so.conf.d/mysql.conf
/usr/local/mysql/lib
[root@localhost mysql]# ldconfig -v//有man的情况下
[root@localhost mysql]# vim /etc/man_db.conf 
#
MANDATORY_MANPATH                       /usr/man
MANDATORY_MANPATH                       /usr/share/man
MANDATORY_MANPATH                       /usr/local/share/man
MANDATORY_MANPATH                       /usr/local/apache/man
MANDATORY_MANPATH                       /usr/local/mysql/man
#---------------------------------------------------------6.修改用户所有者和所属组
[root@localhost ~]# chown -R mysql.mysql /usr/local/mysql
[root@localhost ~]# ll /usr/local/mysql
total 296
drwxr-xr-x.  2 mysql mysql   4096 Oct 12 22:11 bin
drwxr-xr-x.  2 mysql mysql     38 Oct 12 22:11 docs
drwxr-xr-x.  3 mysql mysql   4096 Oct 12 22:11 include
drwxr-xr-x.  6 mysql mysql   4096 Oct 12 22:11 lib
-rw-r--r--.  1 mysql mysql 279355 Oct 12 19:45 LICENSE
drwxr-xr-x.  4 mysql mysql     30 Oct 12 22:11 man
-rw-r--r--.  1 mysql mysql    666 Oct 12 19:45 README
drwxr-xr-x. 28 mysql mysql   4096 Oct 12 22:11 share
drwxr-xr-x.  2 mysql mysql     77 Oct 12 22:11 support-files7.初始化
//创建目录并修改所有者和所属组
[root@localhost ~]# mkdir /opt/data
[root@localhost ~]# chown -R mysql.mysql /opt/data
[root@localhost ~]# ll -d /opt/data
drwxr-xr-x. 2 mysql mysql 6 Dec 11 15:22 /opt/data[root@localhost ~]# mysqld --initialize --user mysql --datadir /opt/data
2023-12-11T07:24:06.252033Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.35) initializing of server in progress as process 391579
2023-12-11T07:24:06.263335Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-12-11T07:24:07.218571Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-12-11T07:24:08.957491Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ix9-C9/has)B
[root@localhost ~]# echo 'ix9-C9/has)B' > pass
[root@localhost ~]# cat pass
ix9-C9/has)B8.生成配置文件
[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve9.配置服务启动脚本
[root@localhost ~]# cd /usr/local/mysql/support-files/
[root@localhost support-files]# ls
mysqld_multi.server  mysql-log-rotate  mysql.server
[root@localhost support-files]# mkdir /etc/init.d
[root@localhost support-files]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost support-files]# vim /etc/init.d/mysqld 
46 basedir=/usr/local/mysql
47 datadir=/opt/data
[root@localhost ~]# systemctl daemon-reload10.启动服务
//关闭防火墙
[root@localhost ~]# systemctl disable --now firewalld
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".
[root@localhost ~]# setenforce 0
[root@localhost ~]# vim /etc/selinux/config
[root@localhost ~]# cat /etc/selinux/config
SELINUX=disabled[root@localhost ~]# service mysqld start
Starting MySQL. SUCCESS! 
[root@localhost ~]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    11.设置开机自启
//先停掉服务
[root@localhost system]# service mysqld stop
Shutting down MySQL.. SUCCESS! 
[root@localhost system]# ss -antl
State              Recv-Q             Send-Q                           Local Address:Port                           Peer Address:Port             Process             
LISTEN             0                  128                                    0.0.0.0:22                                  0.0.0.0:*                                    
LISTEN             0                  511                                          *:80                                        *:*                                    
LISTEN             0                  128                                       [::]:22                                     [::]:*                                    [root@localhost ~]# cd /usr/lib/systemd/system
[root@localhost system]# cp sshd.service mysqld.service
[root@localhost system]# vim mysqld.service 
[root@localhost system]# cat mysqld.service 
[Unit]
Description=mysql server daemon
After=network.target [Service]
Type=forking
ExecStart=service mysqld start
ExecStop=service mysqld stop
ExecReload=/bin/kill -HUP $MAINPID[Install]
WantedBy=multi-user.target
[root@localhost system]# systemctl daemon-reload
[root@localhost system]# systemctl status mysqld
× mysqld.service - mysql server daemonLoaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; preset: disabled)Active: failed (Result: exit-code) since Mon 2023-12-11 16:01:20 CST; 3min 3s agoDuration: 140msMain PID: 574012 (code=exited, status=1/FAILURE)CPU: 171ms
[root@localhost system]# systemctl enable --now mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@localhost system]# systemctl status mysqld
● mysqld.service - mysql server daemonLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)Active: active (running) since Mon 2023-12-11 16:04:47 CST; 4s agoProcess: 590938 ExecStart=service mysqld start (code=exited, status=0/SUCCESS)Main PID: 590955 (mysqld_safe)Tasks: 39 (limit: 100179)Memory: 368.5MCPU: 964msCGroup: /system.slice/mysqld.service
[root@localhost system]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    12.修改数据库密码
[root@localhost ~]# cat pass
ix9-C9/has)B
[root@localhost ~]# mysql -uroot -p'ix9-C9/has)B'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.35Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user root@localhost identified with mysql_native_password by 'Passw0rd@_';
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye//用新密码登入
[root@localhost ~]# mysql -uroot -pPassw0rd@_
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.35 MySQL Community Server - GPLCopyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 

3.3 安装php

1.安装依赖包
[root@localhost ~]# yum list all | grep php | grep mysql
php-mysqlnd.x86_64                                   8.0.30-1.el9_2                      appstream    [root@localhost ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel  pcre-devel freetype freetype-devel gmp gmp-devel  readline readline-devel libxslt libxslt-devel  php-mysqlnd
Complete!
[root@localhost ~]# echo $?
02.下载php软件包(官网下最新的:php.net)
[root@localhost ~]# wget https://www.php.net/distributions/php-8.3.0.tar.xz
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.7.4.tar.gz  apr-util-1.6.3.tar.gz  httpd-2.4.58.tar.gz                         pass
apr-1.7.4        apr-util-1.6.3    httpd-2.4.58           mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz  php-8.3.0.tar.xz3.解压软件包
[root@localhost ~]# tar xf php-8.3.0.tar.xz 
[root@localhost ~]# cd php-8.3.0
[root@localhost php-8.3.0]# ls
appveyor   buildconf.bat        configure.ac     EXTENSIONS  pear                 README.REDIST.BINS  SECURITY.md  UPGRADING
benchmark  CODEOWNERS           CONTRIBUTING.md  LICENSE     php.ini-development  run-tests.php       tests        UPGRADING.INTERNALS
build      CODING_STANDARDS.md  docs             main        php.ini-production   sapi                travis       win32
buildconf  configure            ext              NEWS        README.md            scripts             TSRM         Zend4.编译安装php
[root@localhost php-8.3.0]# ./configure --prefix=/usr/local/php8  \
> --with-config-file-path=/etc \
> --enable-fpm \
> --enable-inline-optimization \
> --disable-debug \
> --disable-rpath \
> --enable-shared \
> --enable-soap \
> --with-openssl \
> --enable-bcmath \
> --with-iconv \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-exif  \
> --enable-ftp \
> --with-gd \
> --with-jpeg-dir \
> --with-png-dir \
> --with-zlib-dir \
> --with-freetype-dir \
> --with-gettext \
> --enable-json \
> --enable-mbstring \
> --enable-pdo \
> --with-mysqli=mysqlnd \
> --with-pdo-mysql=mysqlnd \
> --with-readline \
> --enable-shmop \
> --enable-simplexml \
> --enable-sockets \
> --enable-zip \
> --enable-mysqlnd-compression-support \
> --with-pear \
> --enable-pcntl \
> --enable-posix
configure: WARNING: unrecognized options: --enable-inline-optimization, --with-gd, --with-jpeg-dir, --with-png-dir, --with-freetype-dir, --enable-json, --enable-zip
checking for grep that handles long lines and -e... /usr/bin/grep   //开头的警告configure: error: Package requirements (sqlite3 >= 3.7.7) were not met:  //结尾的报错
Package 'sqlite3', required by 'virtual:world', not found//解决方案
[root@localhost php-8.3.0]# ./configure --help | grep optimization
[root@localhost php-8.3.0]# ./configure --help | grep gd--with-gdbm[=DIR]       DBA: GDBM support--enable-gd             Include GD support--with-external-gd      Use external libgd--with-avif             GD: Enable AVIF support (only for bundled libgd)--with-webp             GD: Enable WEBP support (only for bundled libgd)--with-jpeg             GD: Enable JPEG support (only for bundled libgd)--with-xpm              GD: Enable XPM support (only for bundled libgd)libgd)--enable-gd-jis-conv    GD: Enable JIS-mapped Japanese font support (onlyfor bundled libgd)
[root@localhost php-8.3.0]# ./configure --help | grep jpeg--with-jpeg             GD: Enable JPEG support (only for bundled libgd)
[root@localhost php-8.3.0]# ./configure --help | grep png
[root@localhost php-8.3.0]# ./configure --help | grep freetype--with-freetype         GD: Enable FreeType 2 support (only for bundled
[root@localhost php-8.3.0]# 
[root@localhost php-8.3.0]# ./configure --help | grep json
[root@localhost php-8.3.0]# ./configure --help | grep zip--with-zip              Include Zip read/write support//修改后重新编译
[root@localhost php-8.3.0]#./configure --prefix=/usr/local/php8  \
--with-config-file-path=/etc \
--enable-fpm \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-openssl \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif  \
--enable-ftp \
--enable-gd \
--with-jpeg \
--with-zlib-dir \
--with-freetype \
--with-gettext \
--enable-mbstring \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix
configure: error: Package requirements (sqlite3 >= 3.7.7) were not met:
Package 'sqlite3', required by 'virtual:world', not found//解决方案
[root@localhost php-8.3.0]# yum -y install epel-release
[root@localhost php-8.3.0]# yum list all | grep sqlite3
libsqlite3x.x86_64                                                                       20071018-31.el9                                epel               
libsqlite3x-devel.x86_64                                                                 20071018-31.el9                                epel               
preludedb-sqlite3.x86_64                                                                 5.2.0-2.el9                                    epel               
rubygem-sqlite3.x86_64                                                                   1.4.2-8.el9                                    epel               
rubygem-sqlite3-doc.noarch                                                               1.4.2-8.el9                                    epel               
soci-sqlite3.x86_64                                                                      4.0.3-1.el9                                    epel               
soci-sqlite3-devel.x86_64                                                                4.0.3-1.el9                                    epel               
uwsgi-plugin-sqlite3.x86_64                                                              2.0.23-1.el9                                   epel               
zabbix-dbfiles-sqlite3.noarch                                                            1:6.0.22-2.el9                                 epel               
zabbix-proxy-sqlite3.x86_64                                                              1:6.0.22-2.el9                                 epel               
[root@localhost php-8.3.0]# yum -y install libsqlite3x-devel
Complete!//重新编译
[root@localhost php-8.3.0]# ./configure --prefix=/usr/local/php8  \
.........
configure: error: Package requirements (oniguruma) were not met:
Package 'oniguruma', required by 'virtual:world', not found//解决方案
[root@localhost php-8.3.0]# yum list all | grep oniguruma
oniguruma.i686                                                                           6.9.6-1.el9.5                                  appstream          
oniguruma.x86_64                                                                         6.9.6-1.el9.5                                  appstream          
[root@localhost php-8.3.0]# cd
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
epel-cisco-openh264.repo  epel.repo  epel-testing.repo  rocky-addons.repo  rocky-devel.repo  rocky-extras.repo  rocky.repo
[root@localhost yum.repos.d]# vim rocky-devel.repo 
[root@localhost yum.repos.d]# cat rocky-devel.repo 
[devel]
name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[root@localhost yum.repos.d]# yum list all | grep oniguruma
oniguruma.i686                                                                           6.9.6-1.el9.5                                  appstream          
oniguruma.x86_64                                                                         6.9.6-1.el9.5                                  appstream          
oniguruma.x86_64                                                                         6.9.6-1.el9.5                                  devel              
oniguruma-devel.x86_64                                                                   6.9.6-1.el9.5                                  devel              
[root@localhost php-8.3.0]# yum -y install oniguruma-devel
Complete!//重新编译
[root@localhost php-8.3.0]# ./configure --prefix=/usr/local/php8  \
........
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found//解决方案
[root@localhost php-8.3.0]# yum list all | grep libzip
libzip.i686                                                                              1.7.3-7.el9                                    appstream          
libzip.x86_64                                                                            1.7.3-7.el9                                    appstream          
libzip.x86_64                                                                            1.7.3-7.el9                                    devel              
libzip-devel.x86_64                                                                      1.7.3-7.el9                                    devel              
libzip-tools.x86_64                                                                      1.7.3-7.el9                                    devel              
[root@localhost php-8.3.0]# yum -y install libzip-devel
Complete!//重新编译
[root@localhost php-8.3.0]# ./configure --prefix=/usr/local/php8  \
--with-config-file-path=/etc \
--enable-fpm \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-openssl \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif  \
--enable-ftp \
--enable-gd \
--with-jpeg \
--with-zlib-dir \
--with-freetype \
--with-gettext \
--enable-mbstring \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix
config.status: executing default commands+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE. By continuing this installation  |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+Thank you for using PHP.[root@localhost php-8.3.0]# make
[root@localhost php-8.3.0]# echo $?
0
[root@localhost php-8.3.0]# make install
[root@localhost php-8.3.0]# echo $?
05.配置环境变量
[root@localhost ~]# cd /usr/local/php8
[root@localhost php8]# ls
bin  etc  include  lib  php  sbin  var
[root@localhost php8]# echo 'export PATH=/usr/local/php8/bin:/usr/local/php8/sbin:$PATH' > /etc/profile.d/php8.sh
[root@localhost php8]# source /etc/profile.d/php8.sh
[root@localhost php8]# which php
/usr/local/php8/bin/php
[root@localhost php8]# php -v
PHP 8.3.0 (cli) (built: Dec 11 2023 17:25:44) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies6.配置php-fpm
[root@localhost ~]# cd php-8.3.0
[root@localhost php-8.3.0]# ls
appveyor       CODEOWNERS           configure        EXTENSIONS  main                NEWS                 README.REDIST.BINS  tests                win32
benchmark      CODING_STANDARDS.md  configure.ac     include     Makefile            pear                 run-tests.php       travis               Zend
build          config.log           CONTRIBUTING.md  libs        Makefile.fragments  php.ini-development  sapi                TSRM
buildconf      config.nice          docs             libtool     Makefile.objects    php.ini-production   scripts             UPGRADING
buildconf.bat  config.status        ext              LICENSE     modules             README.md            SECURITY.md         UPGRADING.INTERNALS
[root@localhost php-8.3.0]# cp php.ini-production /etc/php.ini
cp: overwrite '/etc/php.ini'? y
[root@localhost php-8.3.0]# 
[root@localhost php-8.3.0]# cd sapi
[root@localhost sapi]# ls
apache2handler  cgi  cli  embed  fpm  fuzzer  litespeed  phpdbg
[root@localhost sapi]# cd fpm
[root@localhost fpm]# ls
config.m4  fpm             init.d.php-fpm.in  Makefile.frag  php-fpm.8     php-fpm.conf     php-fpm.service     status.html     tests     www.conf.in
CREDITS    init.d.php-fpm  LICENSE            php-fpm        php-fpm.8.in  php-fpm.conf.in  php-fpm.service.in  status.html.in  www.conf
[root@localhost php-8.3.0]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost php-8.3.0]# chmod +x /etc/init.d/php-fpm
[root@localhost php-8.3.0]# ll -d /etc/init.d/php-fpm
-rwxr-xr-x. 1 root root 2402 Dec 11 17:53 /etc/init.d/php-fpm[root@localhost ~]# cd /usr/local/php8
[root@localhost php8]# ls
bin  etc  include  lib  php  sbin  var
[root@localhost php8]# cd /etc
[root@localhost etc]# mv /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
[root@localhost etc]# mv /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf7.启动php.fpm
[root@localhost ~]# service php-fpm start
Starting php-fpm  done
[root@localhost ~]# ss -antl
State              Recv-Q             Send-Q                          Local Address:Port                            Peer Address:Port             Process             
LISTEN             0                  128                                   0.0.0.0:22                                   0.0.0.0:*                                    
LISTEN             0                  4096                                127.0.0.1:9000                                 0.0.0.0:*                                    
LISTEN             0                  151                                         *:3306                                       *:*                                    
LISTEN             0                  70                                          *:33060                                      *:*                                    
LISTEN             0                  511                                         *:80                                         *:*                                    
LISTEN             0                  128                                      [::]:22                                      [::]:*                                    8.配置apache
//启用代理模块
[root@localhost ~]# vim /etc/httpd24/httpd.conf    
LoadModule proxy_module modules/mod_proxy.so  //取消这一行注释
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so   //取消这一行注释
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so//配置虚拟主机测试页面
[root@localhost ~]# cd /usr/local/apache
[root@localhost apache]# ls
bin  build  cgi-bin  error  htdocs  icons  include  logs  man  manual  modules
[root@localhost apache]# cd htdocs/
[root@localhost htdocs]# ls
index.html
[root@localhost htdocs]# mkdir test
[root@localhost htdocs]# ls
index.html  test
[root@localhost htdocs]# cd test
[root@localhost test]# vim index.php
[root@localhost test]# cat index.php
<?php
phpinfo();
?>
[root@localhost test]# chown -R apache.apache /usr/local/apache/htdocs///设置vhosts
[root@localhost ~]# vim /etc/httpd24/httpd.conf 
# Virtual hosts
#Include /etc/httpd24/extra/httpd-vhosts.conf
Include /etc/httpd24/extra/vhosts.conf//添加vhosts
[root@localhost ~]# cd /etc/httpd24/
[root@localhost httpd24]# ls
extra  httpd.conf  magic  mime.types  original
[root@localhost httpd24]# cd extra/
[root@localhost extra]# ls
httpd-autoindex.conf  httpd-default.conf  httpd-languages.conf  httpd-mpm.conf                 httpd-ssl.conf      httpd-vhosts.conf
httpd-dav.conf        httpd-info.conf     httpd-manual.conf     httpd-multilang-errordoc.conf  httpd-userdir.conf  proxy-html.conf
[root@localhost extra]# vim vhosts.conf
[root@localhost extra]# cat vhosts.conf
<VirtualHost *:80>DocumentRoot "/usr/local/apache/htdocs/test"ServerName www.test.comProxyRequests OffProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/test/$1<Directory "/usr/local/apache/htdocs/test">Options noneAllowOverride noneRequire all granted</Directory>
</VirtualHost>  //添加php的类型
[root@localhost ~]# vim /etc/httpd24/httpd.conf #AddType application/x-compress .ZAddType application/x-gzip .gz .tgzAddType application/x-httpd-php .php   //添加这一行AddType application/x-httpd-php-source .phps       //添加这一行 #//添加访问文件
[root@localhost ~]# vim /etc/httpd24/httpd.conf (进去之后用/index.html,搜索到指定页面)
#
<IfModule dir_module>DirectoryIndex index.html  index.php //添加index.php,在index.html前面和后面添加都可以
</IfModule>//重启apache服务与php-fpm
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm  done

3.4 验证

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/279937.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

软件工程-第三版王立福-第1章 绪论

本书结合IEEE最新发布的软件工程体系SWEBOK&#xff0c;和IEEE/ACM软件工程学科小组公布的软件工程教育知识体系SEEK&#xff0c;北大本科生指定教材。注重基础知识的系统性&#xff0c;选材的先进性及知识的应用。2009年出版 软件开发本质的认识&#xff0c;两大技术问题&…

自存vue3 ts jump start-3 computed

computed是一个方法&#xff0c;参数可以接收一个函数&#xff0c;最终返回需要的。获取最新的因数据改变而得到的数据。

《汽车数据安全若干问题合规实践指南》正式发布(百度盘下载)

指南针对汽车数据安全的重要合规内容&#xff0c;结合汽车行业特有场景&#xff0c;参考行业最佳实践&#xff0c;提出合规实践建议。指南旨在进一步提高汽车行业数据安全保护水平&#xff0c;增强汽车企业数据安全合规保障能力&#xff0c;推动汽车数据价值安全使用&#xff0…

京津冀太阳能光伏展

京津冀太阳能光伏展是一个专门展示和推广太阳能光伏技术和产品的展览活动。该展览主要面向京津冀地区的企业、科研院校、政府机构以及普通市民&#xff0c;旨在促进太阳能光伏在京津冀地区的推广应用&#xff0c;推动清洁能源的发展。 在京津冀太阳能光伏展上&#xff0c;参展的…

Zerotier 异地组网方案初探

前言 我之前想要异地组网的话&#xff0c;一般都采用内网穿透的方法&#xff0c;但是这个内网穿透有弊端就是都是要通过公网服务器转发流量&#xff0c;对于大流量的传输就比较不方便&#xff0c;我发现了Zerotier 这个工具非常的好用&#xff0c;是基于p2p的 这是一个类似于…

高效使用 JMeter 生成随机数:探索 Random 和 UUID 算法

在压力测试中&#xff0c;经常需要生成随机值来模拟用户行为。JMeter 提供了多种方式来生成随机值&#xff0c;本文来具体介绍一下。 随机数函数 JMeter 提供了多个用于生成随机数的函数&#xff0c;其中最常用的是__Random函数。该函数可以生成一个指定范围内的随机整数或浮…

【哈希表】算法例题

目录 五、哈希表 39. 赎金信 ① 40. 同构字符串 ① 41. 单词规律 ① 42. 有效的字母异位词 ① 43. 字母异位词分组 ② 44. 两数之和 ① 45. 快乐数 ① 46. 存在重复元素 ① 47. 最长连续序列 ② 五、哈希表 39. 赎金信 ① 给你两个字符串&#xff1a;ransomNote 和 m…

Linux入门-常见指令及权限理解

目录 1、Linux背景 1.1、发展历史 1.2、开源 1.3Linux企业应用现状 2、Linux下的基本命令 2.1、ls 指令 2.2、pwd 命令 2.3、cd 命令 2.4、touch命令 2.5、mkdir 命令 2.6、rmdir 指令和 rm指令 2.7 man 指令 2.8、cp指令 2.9、mv 指令 2.10 cat 2.11 more 2…

网络学习:IPV6基础配置

目录 一、配置接口的全球单播地址 二、配置接口本地链路地址 三、配置接口任播地址 四、配置接口PMTU 配置静态PMTU&#xff1a; 配置动态PMTU&#xff1a; 五、接口配置IPV6地址示例&#xff1a; 一、配置接口的全球单播地址 全球单播地址类似于IPv4公网地址&#xff0…

个人微信开发API

安卓微信的api&#xff0c;个人微信开发API协议&#xff0c;微信 ipad &#xff0c;微信ipad协议&#xff0c;微信web版接口api&#xff0c;微信网页版接口&#xff0c;微信开发sdk&#xff0c;微信开发API&#xff0c;微信协议&#xff0c;微信接口文档&#xff0c;网页个人微…

FPGA高端项目:FPGA基于GS2971+GS2972架构的SDI视频收发+HLS图像缩放+多路视频拼接,提供4套工程源码和技术支持

目录 1、前言免责声明 2、相关方案推荐本博主所有FPGA工程项目-->汇总目录本博已有的 SDI 编解码方案本方案的SDI接收发送本方案的SDI接收图像缩放应用本方案的SDI接收纯verilog图像缩放纯verilog多路视频拼接应用本方案的SDI接收OSD动态字符叠加输出应用本方案的SDI接收HLS…

docker小白第十四天之Portainer与CIG

Portainer简介 Portainer是一款轻量级的应用&#xff0c;它提供了图形化界面&#xff0c;用于方便地管理Docker环境&#xff0c;包括单机环境和集群环境。 Portainer命令安装 # 一个容器可以同时起多个-p端口&#xff0c;restartalways表示随时在线&#xff0c;重启机器后也…

麒麟系统Redis7.2哨兵集群部署

redis哨兵集群部署 1、原理 Redis 哨兵模式是指在 Redis 集群中,有一组专门的进程(即哨兵进程)负责监控主节点和从节点的状态,并在发现故障时自动进行故障转移,以保证 Redis 集群的高可用性。 Redis 提供了哨兵的命令,哨兵命令是一个独立的进程,哨兵进程会周期性地向主…

Flutter开发入门——路由

什么是路由&#xff1f; 移动端应用开发中&#xff0c;路由技术是一个非常重要的组成部分。路由技术负责管理应用中各个页面之间的跳转、导航以及参数传递等关键功能。在移动端应用中&#xff0c;一个高效、易于维护的路由系统对于提高开发效率和用户体验具有重要意义。 Flut…

MySQL 多表查询与事务的操作

一,多表联查 有些数据我们已经拆分成多个表,他们之间通过外键进行连接.当我们要查询两个表的数据,各取其中的一列或者多列. 这时候就需要使用多表联查. 数据准备: # 创建部门表 create table dept(id int primary key auto_increment,name varchar(20) ) insert into dept (n…

【机器学习系列】M3DM工业缺陷检测部署与训练

一.基础资料 1.Git 地址 地址 2.issues issues 3.参考 参考 csdn 二.服务器信息 1.GPU 服务器 GPU 服务器自带 CUDA 安装(前提是需要勾选上)CUDA 需要选择大于 11.3 的版本登录服务器后会自动安装 GPU 驱动 2.CUDA 安装 GPU 服务器自带 CUDA CUDA 版本查看 3.登录信…

软件杯 深度学习 python opencv 实现人脸年龄性别识别

文章目录 0 前言1 项目课题介绍2 关键技术2.1 卷积神经网络2.2 卷积层2.3 池化层2.4 激活函数&#xff1a;2.5 全连接层 3 使用tensorflow中keras模块实现卷积神经网络4 Keras介绍4.1 Keras深度学习模型4.2 Keras中重要的预定义对象4.3 Keras的网络层构造 5 数据集处理训练5.1 …

软件企业在咨询第三方软件测试机构报价时,应提前准备什么资料?

近年来&#xff0c;随着软件行业的迅速发展&#xff0c;软件企业对于软件质量的重视程度日益增加。为了确保软件产品的质量以及用户的满意度&#xff0c;越来越多的企业倾向于委托第三方软件测试机构进行测试工作。在咨询第三方软件测试机构报价之前&#xff0c;软件企业需要提…

软考81-上午题-【面向对象技术3-设计模式】-行为型设计模式01

一、行为型设计模式一览 二、责任链模式 2-1、意图 使多个对象都有机会处理请求&#xff0c;从而避免请求的发送者和接收者之间的耦合关系。将这些对象连成一条链&#xff0c;并沿着这条链传递该请求&#xff0c;直到有一个对象处理它为止。 1-2、结构 1-3、代码实现 1-4、适…

C/C++炸弹人游戏

参考书籍《啊哈&#xff0c;算法》&#xff0c;很有意思的一本算法书&#xff0c;小白也可以看懂&#xff0c;详细见书&#xff0c;这里只提供代码和运行结果。 这里用到的是枚举思想&#xff0c;还有更好地搜索做法。 如果大家有看不懂的地方或提出建议&#xff0c;欢迎评论区…