栏目分类:
子分类:
返回
终身学习网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
终身学习网 > IT > 软件开发 > 后端开发 > Python

lamp架构

Python 更新时间:发布时间: 百科书网 趣学号

lamp简介

Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序(除了Linux外),但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台

从网站的流量上来说,70%以上的访问流量是LAMP来提供的,LAMP是最强大的网站解决方案

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

优势:免费和开源

web服务器工作流程

Web资源介绍

html:静态资源 ,可以理解为前端的固定页面,这里面包含HTML、CSS、JS、图片等等,不需要查数据库也不需要程序处理,直接就能够显示的页面,如果想修改内容则必须修改页面,但是访问效率相当高。

JSP/Servlet:动态资源 需要程序处理或者从数据库中读数据,能够根据不同的条件在页面显示不同的数据,内容更新不需要修改页面但是访问速度不及静态页面。(,需要先转换成html,再给浏览器看 )

补充:

xx.php (Linux)
xx.jsp (C++)
xx.do (java)
xx.py (python)
xx.wsgi(python)

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上下文切换而导致耗时


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

lamp平台构建

环境说明:

IP需要安装的服务
192.168.142.101httpd-2.4 mysql-5.7 php php-mysql

lamp平台软件安装次序:

httpd --> mysql --> php

注意:php要求httpd使用prefork MPM

安装安装包

[root@localhost src ~]# wget http://dlcdn.apache.org/httpd/httpd-2.4.49.tar.gz--2021-09-24 11:50:58--  http://dlcdn.apache.org/httpd/httpd-2.4.49.tar.gz正在解析主机 dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644正在连接 dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:80... 已连接。已发出 HTTP 请求,正在等待回应... 200 OK长度:9421895 (9.0M) [application/x-gzip]正在保存至: “httpd-2.4.49.tar.gz”httpd-2.4.49.tar.gz  100%[=====================>]   8.99M  2.83MB/s  用时 3.2s    2021-09-24 11:51:01 (2.83 MB/s) - 已保存 “httpd-2.4.49.tar.gz” [9421895/9421895])[root@localhost src ~]# wget http://dlcdn.apache.org/apr/apr-1.7.0.tar.gz--2021-09-24 11:51:21--  http://dlcdn.apache.org/apr/apr-1.7.0.tar.gz正在解析主机 dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644正在连接 dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:80... 已连接。已发出 HTTP 请求,正在等待回应... 200 OK长度:1093896 (1.0M) [application/x-gzip]正在保存至: “apr-1.7.0.tar.gz”apr-1.7.0.tar.gz     100%[=====================>]   1.04M  2.03MB/s  用时 0.5s    2021-09-24 11:51:22 (2.03 MB/s) - 已保存 “apr-1.7.0.tar.gz” [1093896/1093896])[root@localhost src ~]# wget http://dlcdn.apache.org/apr/apr-util-1.6.1.tar.gz--2021-09-24 11:51:31--  http://dlcdn.apache.org/apr/apr-util-1.6.1.tar.gz正在解析主机 dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644正在连接 dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:80... 已连接。已发出 HTTP 请求,正在等待回应... 200 OK长度:554301 (541K) [application/x-gzip]正在保存至: “apr-util-1.6.1.tar.gz”apr-util-1.6.1.tar.g 100%[=====================>] 541.31K  1.64MB/s  用时 0.3s    2021-09-24 11:51:32 (1.64 MB/s) - 已保存 “apr-util-1.6.1.tar.gz” [554301/554301])[root@localhost src ~]# tar xf apr-1.7.0.tar.gz [root@localhost src ~]# tar xf apr-util-1.6.1.tar.gz [root@localhost src ~]# tar xf httpd-2.4.49.tar.gz [root@localhost src ~]# ls公共  文档  anaconda-ks.cfg   apr-util-1.6.1.tar.gz  lamp模板  下载  apr-1.7.0         httpd-2.4.49视频  音乐  apr-1.7.0.tar.gz  httpd-2.4.49.tar.gz图片  桌面  apr-util-1.6.1    initial-setup-ks.cfg#安装依赖包[root@localhost src ~]# yum -y groups mark install 'Development Tools'Updating Subscription Management repositories.Unable to read consumer identityThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.上次元数据过期检查:0:02:24 前,执行于 2021年09月24日 星期五 12时00分27秒。依赖关系解决。=================================================================================== 软件包             架构              版本                仓库                大小===================================================================================安装组: Development Tools                                                                事务概要===================================================================================完毕![root@localhost src ~]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ makeUpdating Subscription Management repositories.Unable to read consumer identityThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.上次元数据过期检查:0:03:18 前,执行于 2021年09月24日 星期五 12时00分27秒。依赖关系解决。=================================================================================== 软件包                   架构        版本                    仓库            大小===================================================================================安装: expat-devel              x86_64      2.2.5-3.el8             baseOS          55 k gcc                      x86_64      8.3.1-5.el8             Appstream       23 M gcc-c++                  x86_64      8.3.1-5.el8             Appstream       12 M libtool                  x86_64      2.4.6-25.el8            Appstream      709 k make                     x86_64      1:4.2.1-10.el8          baseOS         498 k openssl-devel            x86_64      1:1.1.1c-15.el8         baseOS         2.3 M pcre-devel               x86_64      8.42-4.el8              baseOS         551 k安装依赖关系:···[root@localhost src ~]# cd apr-1.7.0/[root@localhost apr-1.7.0]# vim configure cfgfile=${ofile}T    trap "$RM "$cfgfile"; exit 1" 1 2 15    # $RM "$cfgfile"    #注释掉#编译安装[root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/aprchecking build system type... x86_64-pc-linux-gnuchecking host system type... x86_64-pc-linux-gnuchecking target system type... x86_64-pc-linux-gnuConfiguring APR libraryPlatform: x86_64-pc-linux-gnuchecking for working mkdir -p... yesAPR Version: 1.7.0checking for chosen layout... aprchecking for gcc... gccchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables... checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none needed[root@localhost apr-1.7.0]# make && make install···/usr/bin/install -c -m 755 /root/apr-1.7.0/build/mkdir.sh /usr/local/apr/build-1for f in make_exports.awk make_var_export.awk; do     /usr/bin/install -c -m 644 /root/apr-1.7.0/build/${f} /usr/local/apr/build-1; done/usr/bin/install -c -m 644 build/apr_rules.out /usr/local/apr/build-1/apr_rules.mk/usr/bin/install -c -m 755 apr-config.out /usr/local/apr/bin/apr-1-config#进行编译[root@localhost ~]# cd /usr/src/apr-util-1.6.1/[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprchecking build system type... x86_64-pc-linux-gnuchecking host system type... x86_64-pc-linux-gnuchecking target system type... x86_64-pc-linux-gnuchecking for a BSD-compatible install... /usr/bin/install -cchecking for working mkdir -p... yesAPR-util Version: 1.6.1checking for chosen layout... apr-utilchecking for gcc... gcc[root@localhost apr-util-1.6.1]# make && make install···   - have your system administrator add LIBDIR to '/etc/ld.so.conf'See any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.----------------------------------------------------------------------/usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util/lib/usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util/bin/apu-1-config[root@localhost apr-util-1.6.1]# cd /usr/src/httpd-2.4.49/[root@localhost httpd-2.4.49]# ./configure --prefix=/usr/local/apache > --enable-so > --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=preforkchecking for chosen layout... Apachechecking for working mkdir -p... yes···configure: summary of build options:    Server Version: 2.4.49    Install prefix: /usr/local/apache    C compiler:     gcc    CFLAGS:          -g -O2 -pthread      CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE      LDFLAGS:               LIBS:                 C preprocessor: gcc -E[root@localhost httpd-2.4.49]# make && make install···Installing build system filesmkdir /usr/local/apache/buildInstalling man pages and online manualmkdir /usr/local/apache/manmkdir /usr/local/apache/man/man1mkdir /usr/local/apache/man/man8mkdir /usr/local/apache/manualmake[1]: 离开目录“/usr/src/httpd-2.4.49”[root@localhost httpd-2.4.49]# vim /etc/man_db.confMANDATORY_MANPATH                       /usr/manMANDATORY_MANPATH                       /usr/share/manMANDATORY_MANPATH                       /usr/local/share/manMANDATORY_MANPATH                       /usr/local/apache/man#去掉注释[root@localhost httpd-2.4.49]# vim /usr/local/apache/conf/httpd.conf ServerName www.example.com:80#启动apache查看是否开启[root@localhost httpd-2.4.49]# apachectl start[root@localhost httpd-2.4.49]# ss -anltState     Recv-Q    Send-Q         Local Address:Port         Peer Address:Port    LISTEN    0         32             192.168.122.1:53                0.0.0.0:*       LISTEN    0         128                  0.0.0.0:22                0.0.0.0:*       LISTEN    0         5                  127.0.0.1:631               0.0.0.0:*       LISTEN    0         128                  0.0.0.0:111               0.0.0.0:*       LISTEN    0         128                     [::]:22                   [::]:*       LISTEN    0         5                      [::1]:631                  [::]:*       LISTEN    0         128                     [::]:111                  [::]:*       LISTEN    0         128                        *:80                      *:*   [root@localhost ~]# vim /usr/lib/systemd/system/httpd.service[root@localhost ~]# cat /usr/lib/systemd/system/httpd.service[Unit]Description=Httpd server daemondocumentation=man:httpd(8)After=network.target[Service]Type=forkingExecStart=/usr/local/apache/bin/apachectl startExecStop=/usr/local/apache/bin/apachectl stopExecReload=/bin/kill -HUP $MAINPID[Install]WantedBy=multi-user.target[root@localhost ~]# systemctl daemon-reload [root@localhost ~]# systemctl status httpd.service ● httpd.service - Httpd server daemon   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset:>   Active: inactive (dead)     Docs: man:httpd(8)9月 24 12:32:30 localhost.localdomain systemd[1]: /usr/lib/systemd/system/httpd.se>9月 24 12:32:30 localhost.localdomain systemd[1]: /usr/lib/systemd/system/httpd.se>9月 24 12:32:30 localhost.localdomain systemd[1]: /usr/lib/systemd/system/httpd.se>9月 24 12:32:30 localhost.localdomain systemd[1]: /usr/lib/systemd/system/httpd.se>9月 24 12:32:30 localhost.localdomain systemd[1]: /usr/lib/systemd/system/httpd.se>9月 24 12:33:33 localhost.localdomain systemd[1]: /usr/lib/systemd/system/httpd.se>lines 1-11/11 (END)[root@localhost ~]# apachectl stop  [root@localhost ~]# systemctl enable --now httpdCreated symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.[root@localhost ~]# systemctl status httpd.service ● httpd.service - Httpd server daemon   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: >   Active: active (running) since Fri 2021-09-24 12:36:03 CST; 8s ago     Docs: man:httpd(8)  Process: 151521 ExecStart=/usr/local/apache/bin/apachectl start (code=exited, st> Main PID: 151524 (httpd)    Tasks: 6 (limit: 4704)   Memory: 8.5M   CGroup: /system.slice/httpd.service           ├─151524 /usr/local/apache/bin/httpd -k start           ├─151525 /usr/local/apache/bin/httpd -k start           ├─151526 /usr/local/apache/bin/httpd -k start           ├─151527 /usr/local/apache/bin/httpd -k start           ├─151528 /usr/local/apache/bin/httpd -k start           └─151529 /usr/local/apache/bin/httpd -k start

安装mysql

[root@localhost ~]#  yum -y install ncurses-devel openssl-devel openssl cmake mariadb-develUpdating Subscription Management repositories.Unable to read consumer identityThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.上次元数据过期检查:0:36:53 前,执行于 2021年09月24日 星期五 12时00分27秒。软件包 openssl-devel-1:1.1.1c-15.el8.x86_64 已安装。软件包 openssl-1:1.1.1c-15.el8.x86_64 已安装。依赖关系解决。=================================================================================== 软件包                     架构   版本                            仓库       大小===================================================================================安装: cmake                      x86_64 3.11.4-7.el8                    Appstream 8.1 M mariadb-devel              x86_64 3:10.3.17-1.module+el8.1.0+3974+90eded84                                            Appstream 1.0 M ncurses-devel              x86_64 6.1-7.20180224.el8              baseOS    528 k安装依赖关系: cmake-data                 noarch 3.11.4-7.el8                    Appstream 1.3 M[root@localhost ~]# useradd -r -M -s /sbin/nologin mysql[root@localhost src]# tar xf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/[root@localhost src]# cd /usr/local/[root@localhost local]# mv mysql-5.7.22-linux-glibc2.12-x86_64/ mysql[root@localhost local]# chown -R mysql.mysql mysql[root@localhost local]# ll总用量 0drwxr-xr-x. 14 root  root  164 9月  24 12:25 apachedrwxr-xr-x.  6 root  root   58 9月  24 12:09 aprdrwxr-xr-x.  5 root  root   43 9月  24 12:15 apr-utildrwxr-xr-x.  2 root  root    6 8月  12 2018 bindrwxr-xr-x.  2 root  root    6 8月  12 2018 etcdrwxr-xr-x.  2 root  root    6 8月  12 2018 gamesdrwxr-xr-x.  2 root  root    6 8月  12 2018 includedrwxr-xr-x.  2 root  root    6 8月  12 2018 libdrwxr-xr-x.  2 root  root    6 8月  12 2018 lib64drwxr-xr-x.  2 root  root    6 8月  12 2018 libexecdrwxr-xr-x.  9 mysql mysql 129 9月  24 12:43 mysqldrwxr-xr-x.  2 root  root    6 8月  12 2018 sbindrwxr-xr-x.  5 root  root   49 9月  16 16:00 sharedrwxr-xr-x.  2 root  root    6 8月  12 2018 src[root@localhost local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh[root@localhost local]# source /etc/profile.d/mysql.sh[root@localhost local]# which mysql/usr/local/mysql/bin/mysql[root@localhost local]# cd[root@localhost ~]# vim /etc/man_db.conf MANDATORY_MANPATH                       /usr/manMANDATORY_MANPATH                       /usr/share/manMANDATORY_MANPATH                       /usr/local/share/manMANDATORY_MANPATH                       /usr/local/apache/manMANDATORY_MANPATH                       /usr/local/mysql/man[root@localhost ~]# vim /etc/man_db.conf [root@localhost ~]# ln -s /usr/local/mysql/include/ /usr/include/mysql/[root@localhost ~]# vim /etc/ld.so.conf.d/mysql.conf[root@localhost ~]# cat /etc/ld.so.conf.d/mysql.conf/usr/local/mysql/lib#初始数据库[root@localhost ~]# mkdir /opt/data[root@localhost ~]# chown  -R mysql.mysql /opt/data/[root@localhost ~]# mysqld --initialize --user=mysql --datadir=/opt/data/2021-09-24T04:46:56.112922Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2021-09-24T04:46:56.755191Z 0 [Warning] InnoDB: New log files created, LSN=457902021-09-24T04:46:56.819335Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2021-09-24T04:46:56.919882Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 726f3b76-1cf2-11ec-8dea-000c29e514ad.2021-09-24T04:46:56.921213Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2021-09-24T04:46:56.922434Z 1 [Note] A temporary password is generated for root@localhost: B#ggxi /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> EOF[root@localhost ~]# cat /etc/my.cnf[mysqld]basedir = /usr/local/mysqldatadir = /opt/datasocket = /tmp/mysql.sockport = 3306pid-file = /opt/data/mysql.piduser = mysqlskip-name-resolve[root@localhost ~]# vim /usr/local/mysql/support-files/mysql.server basedir=/usr/local/mysqldatadir=/opt/data[root@localhost ~]# cp /usr/lib/systemd/system/httpd.service  /usr/lib/systemd/system/mysqld.service[root@localhost ~]# vim  /usr/lib/systemd/system/mysqld.service[root@localhost ~]# cat  /usr/lib/systemd/system/mysqld.service[Unit]Description=mysql server daemonAfter=network.target[Service]Type=forkingExecStart=/usr/local/support-files/mysql.service startExecStop=/usr/local/support-files/mysql.service stopExecReload=/bin/kill -HUP $MAINPID[Install]WantedBy=multi-user.target[root@localhost ~]# ps -ef|grep mysqlroot      182943  165702  0 12:51 pts/1    00:00:00 grep --color=auto mysql[root@localhost ~]# ss -antlState     Recv-Q    Send-Q         Local Address:Port         Peer Address:Port    LISTEN    0         32             192.168.122.1:53                0.0.0.0:*       LISTEN    0         128                  0.0.0.0:22                0.0.0.0:*       LISTEN    0         5                  127.0.0.1:631               0.0.0.0:*       LISTEN    0         128                  0.0.0.0:111               0.0.0.0:*       LISTEN    0         128                     [::]:22                   [::]:*       LISTEN    0         5                      [::1]:631                  [::]:*       LISTEN    0         128                     [::]:111                  [::]:*       LISTEN    0         128                        *:80                      *:*    [root@localhost ~]# yum -y install ncurses-compat-libsUpdating Subscription Management repositories.Unable to read consumer identityThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.上次元数据过期检查:0:51:30 前,执行于 2021年09月24日 星期五 12时00分27秒。依赖关系解决。=================================================================================== 软件包                   架构        版本                       仓库         大小===================================================================================安装: ncurses-compat-libs      x86_64      6.1-7.20180224.el8         baseOS      331 k事务概要===================================================================================安装  1 软件包#进入mysql验证[root@localhost ~]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or g.Your MySQL connection id is 3Server version: 5.7.34Copyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.mysql> set password = password('1');Query OK, 0 rows affected, 1 warning (0.09 sec)

安装php

[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 libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel上次元数据过期检查:0:54:30 前,执行于 2021年09月24日 星期五 12时00分27秒。软件包 libxml2-2.9.7-7.el8.x86_64 已安装。软件包 openssl-1:1.1.1c-15.el8.x86_64 已安装。软件包 openssl-devel-1:1.1.1c-15.el8.x86_64 已安装。软件包 bzip2-1.0.6-26.el8.x86_64 已安装。软件包 libcurl-7.61.1-12.el8.x86_64 已安装。软件包 libjpeg-turbo-1.5.3-10.el8.x86_64 已安装。软件包 libpng-2:1.6.34-5.el8.x86_64 已安装。软件包 pcre-devel-8.42-4.el8.x86_64 已安装。软件包 freetype-2.9.1-4.el8.x86_64 已安装。软件包 gmp-1:6.1.2-10.el8.x86_64 已安装。No match for argument: libmcryptNo match for argument: libmcrypt-devel软件包 readline-7.0-10.el8.x86_64 已安装。软件包 libxslt-1.1.32-4.el8.x86_64 已安装。[root@localhost ~]#  yum -y install php-mysqlndUpdating Subscription Management repositories.Unable to read consumer identityThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.上次元数据过期检查:0:55:54 前,执行于 2021年09月24日 星期五 12时00分27秒。依赖关系解决。=================================================================================== 软件包        架构     版本                                     仓库         大小===================================================================================安装: php-mysqlnd   x86_64   7.2.24-1.module+el8.2.0+4601+7c76a223    Appstream   191 k安装依赖关系: php-common    x86_64   7.2.24-1.module+el8.2.0+4601+7c76a223    Appstream   662 k php-pdo       x86_64   7.2.24-1.module+el8.2.0+4601+7c76a223    Appstream   123 k启用模块流:root@localhost src]# tar xf php-8.0.10.tar.xz [root@localhost ~]# yum -y install libsqlite3x-devel[root@localhost php-8.0.10]# yum -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm --skip-broken[root@localhost php-8.0.10]# ./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 > --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·······················+--------------------------------------------------------------------+| 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.0.10]# make && make install//安装后配置[root@localhost ~]#  echo 'export PATH=/usr/local/php8/bin:$PATH' > /etc/profile.d/php.sh[root@localhost ~]# source /etc/profile.d/php.sh[root@localhost php-8.0.10]# cp  php.ini-production /etc/php.inicp:是否覆盖'/etc/php.ini'? y[root@localhost php-8.0.10]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm[root@localhost php-8.0.10]#  chmod +x /etc/rc.d/init.d/php-fpm[root@localhost php-8.0.10]# cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf[root@localhost php-8.0.10]# cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf[root@localhost ~]# vim /usr/local/apache/conf/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.soLoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so//取消两行注释[root@localhost ~]# cp /usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/php-fpm.service[root@localhost ~]# vim /usr/lib/systemd/system/php-fpm.service[root@localhost ~]# cat /usr/lib/systemd/system/php-fpm.service[Unit]Description=php server daemonAfter=network.target[Service]Type=forkingExecStart=/etc/init.d/php-fpm startExecStop==/etc/init.d/php-fpm stopExecReload=/bin/kill -HUP $MAINPID[Install]WantedBy=multi-user.target[root@localhost ~]# systemctl daemon-reload [root@localhost ~]# systemctl enable --now php-fpm.service [root@localhost ~]# systemctl status php-fpm.service ● php-fpm.service - php server daemon   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)   Active: active (running) since Thu 2021-09-23 12:42:12 EDT; 5s ago  Process: 124457 ExecStart=/etc/init.d/php-fpm start (code=exited, status=0/SUCCESS) Main PID: 124459 (php-fpm)    Tasks: 3 (limit: 16496)   Memory: 9.8M   CGroup: /system.slice/php-fpm.service           ├─124459 php-fpm: master process (/usr/local/php8/etc/php-fpm.conf)           ├─124460 php-fpm: pool www           └─124461 php-fpm: pool www[root@localhost ~]# ss -antlState     Recv-Q    Send-Q       Local Address:Port       Peer Address:Port   LISTEN    0         128              127.0.0.1:9000            0.0.0.0:*                 LISTEN    0         80                       *:3306                  *:*      LISTEN    0         128                   [::]:111                [::]:*      LISTEN    0         128                      *:80                    *:*      LISTEN    0         128                   [::]:22                 [::]:*      LISTEN    0         5                    [::1]:631                [::]:* [root@localhost ~]# ps -ef|grep phproot      119755    2197  0 12:41 pts/2    00:00:00 systemctl status php-fpm.serviceroot      124459       1  0 12:42 ?        00:00:00 php-fpm: master process (/usr/local/php8/etc/php-fpm.conf)nobody    124460  124459  0 12:42 ?        00:00:00 php-fpm: pool wwwnobody    124461  124459  0 12:42 ?        00:00:00 php-fpm: pool wwwroot      134100    2197  0 12:44 pts/2    00:00:00 grep --color=auto php[root@localhost ~]# cd /usr/local/apache/[root@localhost apache]# lsbin    cgi-bin  error   icons    logs  manualbuild  conf     htdocs  include  man   modules[root@localhost apache]# cd htdocs/[root@localhost htdocs]# lsindex.html[root@localhost htdocs]# mkdir test[root@localhost htdocs]# vim test/index.php[root@localhost htdocs]# cat test/index.php [root@localhost apache]# chown -R apache.apache /usr/local/apache/htdocs/[root@localhost apache]# vim conf/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        #添加此行//加在最后    documentRoot "/usr/local/apache/htdocs/test"    ServerName www.yy.com    ProxyRequests Off    ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/yy.com/$1            Options none        AllowOverride none        Require all granted        DirectoryIndex index.php index.html     //添加index.php[root@localhost ~]# systemctl restart httpd.service 

验证

转载请注明:文章转载自 www.051e.com
本文地址:http://www.051e.com/it/268520.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 ©2023-2025 051e.com

ICP备案号:京ICP备12030808号