源码部署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.gz

4.解压软件包
[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.gz

5.编译软件包
//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 configure
    cfgfile=${ofile}T
    trap "$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.58
    Install prefix: /usr/local/apache
    C compiler:     gcc
    CFLAGS:          -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 $?
0

6.配置环境变量
[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 daemon
     Loaded: 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 daemon
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
     Active: active (running) since Mon 2023-12-11 14:48:00 CST; 5s ago
     Process: 222039 ExecStart=/usr/local/apache/bin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 222042 (httpd)
      Tasks: 6 (limit: 100179)
     Memory: 5.4M
        CPU: 31ms
     CGroup: /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 start

Dec 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.xz

4.解压软件包
[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  src

5.配置环境变量
[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-files

7.初始化
//创建目录并修改所有者和所属组
[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)B

8.生成配置文件
[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-resolve

9.配置服务启动脚本
[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-reload

10.启动服务
//关闭防火墙
[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 daemon
     Loaded: 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 ago
   Duration: 140ms
   Main 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 daemon
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Mon 2023-12-11 16:04:47 CST; 4s ago
    Process: 590938 ExecStart=service mysqld start (code=exited, status=0/SUCCESS)
   Main PID: 590955 (mysqld_safe)
      Tasks: 39 (limit: 100179)
     Memory: 368.5M
        CPU: 964ms
     CGroup: /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.35

Copyright (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 - GPL

Copyright (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 $?
0

2.下载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.xz

3.解压软件包
[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         Zend

4.编译安装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 (only
                          for 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 $?
0

5.配置环境变量
[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 Technologies

6.配置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.conf

7.启动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.com
    ProxyRequests Off
    ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/test/$1
    <Directory "/usr/local/apache/htdocs/test">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>  

//添加php的类型
[root@localhost ~]# vim /etc/httpd24/httpd.conf 
 #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType 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 验证

在这里插入图片描述

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

腾讯云服务器按月收费价格表,优惠价格5元一个月起

2024腾讯云服务器多少钱一个月&#xff1f;5元1个月起&#xff0c;腾讯云轻量服务器4核16G12M带宽32元1个月、96元3个月&#xff0c;8核32G22M配置115元一个月、345元3个月&#xff0c;腾讯云轻量应用服务器61元一年折合5元一个月、4核8G12M配置646元15个月、2核4G5M服务器165元…

● 647. 回文子串 ● 516.最长回文子序列 ● 动态规划总结篇

● 647. 回文子串 1.dp数组含义。 之前的题目&#xff0c;差不多都是求什么就怎么定义dp数组&#xff0c;最后返回dp的最后一个元素。但是这里如果定义一维数组dp[i]是[0,i]范围的回文子串的个数的话&#xff0c;怎么根据dp[i-1]得到dp[i]&#xff1f;发现很难找到递归关系…

窗口函数(sample database classicmodels _No.8 )

窗口函数&#xff08;sample database classicmodels _No.8 &#xff09; 准备工作&#xff0c;可以去下载 classicmodels 数据库具体如下 点击&#xff1a;classicmodels 也可以去 下面我的博客资源下载 https://download.csdn.net/download/tomxjc/88685970 文章目录 窗口函…

Java八股文(RabbitMQ)

Java八股文のRabbitMQ RabbitMQ RabbitMQ RabbitMQ 是什么&#xff1f;它解决了哪些问题&#xff1f; RabbitMQ 是一个开源的消息代理中间件&#xff0c;用于在应用程序之间进行可靠的异步消息传递。 它解决了应用程序间解耦、消息传递、负载均衡、故障恢复等问题。 RabbitMQ …

鸿蒙开发学习:【appspawn应用孵化组件】

功能简介 应用孵化器&#xff0c;负责接受应用程序框架的命令孵化应用进程&#xff0c;设置其对应权限&#xff0c;并调用应用程序框架的入口。 基本概念 appspawn注册的服务名称为“appspawn”。appspawn 通过监听本地socket&#xff0c;接收来自客户端的请求消息。消息类型…

Linux-MDK can电机带导轨 C++封装

我使用的是MKS的52D can电机带导轨&#xff0c;现在我要根据电机说明书将运动指令封装&#xff0c;有一个限位开关&#xff0c; 闭合时高电平 滑块需要运动在限位开关左侧&#xff0c;所以限位归零的方向为顺时针 根据说明书&#xff0c;我要设置的命令应该是&#xff1a; ca…

JavaScript实现简单的表单验证

关键代码&#xff1a; <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document</title><s…

13|连接数据库:通过链和代理查询鲜花信息

新的数据库查询范式 提出问题&#xff1a;用户用自然语言提出一个问题&#xff0c;例如“去年的总销售额是多少&#xff1f;”。LLM 理解并转译&#xff1a;LLM 首先会解析这个问题&#xff0c;理解其背后的意图和所需的信息。接着&#xff0c;模型会根据解析的内容&#xff0c…

蓝桥杯---代分数

import java.util.Scanner;public class top4 {//全排列分数的那个题目//首先进行n个数的全排列//然后将这n个数字拆分为3个数字&#xff0c;即插入两个板子//然后判断等式是否成立&#xff08;判断条件就是在if里面去进行相关的判断是吗&#xff1f;&#xff1f;&#xff09;s…

一文搞懂机器学习

一、引言 在当今的数字时代&#xff0c;一个概念不断出现在科技前沿的讨论中 —— 机器学习。作为人工智能领域的一个重要分支&#xff0c;机器学习已经从理论研究走向实际应用&#xff0c;深刻地改变着我们的工作和生活方式。 机器学习的核心思想是让机器通过数据学习并做出…

【教学类-44-08】20240319 “(幼儿用)数字练习簿1.0”(A4版)

背景需求&#xff1a; 我一直想把 “&#xff08;幼儿用&#xff09;数字练习簿”的内容复刻出来——这里面的字体始终找不到&#xff0c;是一种已经做成图片的手写数字字体 素材准备&#xff1a; 1、买了一本&#xff08;幼儿用&#xff09;数字练习簿&#xff0c;把每一页扫…

蓝桥杯--基础(哈夫曼)

import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner;public class BASIC28 {//哈夫曼书public static void main(String[] args) {Scanner Scannernew Scanner(System.in);int nScanner.nextInt();List<Integer&…

Visual Studio 2013 - 调试模式下查看监视窗口

Visual Studio 2013 - 调试模式下查看监视窗口 1. 监视窗口References 1. 监视窗口 Ctrl Alt W&#xff0c;1-4&#xff1a;监视窗口 (数字键不能使用小键盘) or 调试 -> 窗口 -> 监视 -> 监视 1-4 调试状态下使用&#xff1a; 在窗口中点击空白行&#xff0c;…

Java项目打包成Docker镜像

将项目打包成Docker镜像 将项目打包成Docker镜像的原因是可以在一台电脑的环境下模拟多台不同性能电脑响应高并发请求时候的表现。这里我们模拟半个CPU、一个CPU还有两个CPU的情况 在pom.xml文件中添加jib插件&#xff08;前提电脑安装了maven和Java 的 JDK才能成功完成编译&…

学习笔记 | 微信小程序项目day04

今日学习内容 热门推荐下转页面 热门推荐下转页面 1、定义类型 import type { PageResult, GoodsItem } from ./global/** 热门推荐 */ export type HotResult {/** id信息 */id: string/** 活动图片 */bannerPicture: string/** 活动标题 */title: string/** 子类选项 */…

STM32—控制蜂鸣器(定时器)

目录 1 、 电路构成及原理图 2 、编写实现代码 main.c tim_irq.c 3、代码讲解 4、烧录到开发板调试、验证代码 5、检验效果 此笔记基于朗峰 STM32F103 系列全集成开发板的记录。 1 、 电路构成及原理图 定时器中断是利用定时器的计数功能&#xff08;向上计数或向下计…

Java 多线程(抢CPU)

哈哈哈 什么是多线程&#xff1a;可以让程序同时做多件事情。 多线程的作用&#xff1a;提高效率。 多线程的应用场景&#xff1a;想让多个事情同时运行。 并发&#xff08;多个指令在单个CPU交替执行&#xff09;和并行&#xff08;多个指令在多个CPU交替执行&#xff09; …

《UE5_C++多人TPS完整教程》学习笔记28 ——《P29 Mixamo 动画(Mixamo Animations)》

本文为B站系列教学视频 《UE5_C多人TPS完整教程》 —— 《P29 Mixamo动画&#xff08;Mixamo Animations&#xff09;》 的学习笔记&#xff0c;该系列教学视频为 Udemy 课程 《Unreal Engine 5 C Multiplayer Shooter》 的中文字幕翻译版&#xff0c;UP主&#xff08;也是译者…

MySQL数据自动同步到Es

Logstash 测试数据准备 DROP DATABASE IF EXISTS es;CREATE DATABASE es DEFAULT CHARACTER SET utf8;USE es;CREATE TABLE book (id INT NOT NULL,title VARCHAR(20),author VARCHAR(20),price DECIMAL(6,2),PRIMARY KEY(id) );DROP PROCEDURE IF EXISTS batchInsertBook;DELI…

飞桨AI应用@riscv OpenKylin

在riscv编译安装飞桨PaddlePaddle参见&#xff1a; 算能RISC-V通用云编译飞桨paddlepaddleopenKylin留档_在riscv下进行paddlelite源码编译-CSDN博客 安装好飞桨&#xff0c;就可以用飞桨进行推理了。刚开始计划用ONNX推理&#xff0c;但是在算能云没有装上&#xff0c;所以最…