源码编译部署LAMP

编译部署LAMP

配置apache

[root@zyq ~]#: wget https://downloads.apache.org/apr/apr-1.7.4.tar.gz
--2023-12-11 14:35:57--  https://downloads.apache.org/apr/apr-1.7.4.tar.gz
Resolving downloads.apache.org (downloads.apache.org)... 88.99.95.219, 135.181.214.104, 2a01:4f8:10a:201a::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1122147 (1.1M) [application/x-gzip]
Saving to: ‘apr-1.7.4.tar.gz’

apr-1.7.4.tar.g 100%[=======>]   1.07M   317KB/s    in 3.5s    

2023-12-11 14:36:01 (317 KB/s) - ‘apr-1.7.4.tar.gz’ saved [1122147/1122147]

[root@zyq ~]#: wget https://downloads.apache.org/apr/apr-util-1.6.3.tar.gz
--2023-12-11 14:36:58--  https://downloads.apache.org/apr/apr-util-1.6.3.tar.gz
Resolving downloads.apache.org (downloads.apache.org)... 88.99.95.219, 135.181.214.104, 2a01:4f8:10a:201a::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 556623 (544K) [application/x-gzip]
Saving to: ‘apr-util-1.6.3.tar.gz’

apr-util-1.6.3. 100%[=======>] 543.58K   397KB/s    in 1.4s    

2023-12-11 14:37:00 (397 KB/s) - ‘apr-util-1.6.3.tar.gz’ saved [556623/556623]

[root@zyq ~]#: wget https://downloads.apache.org/httpd/httpd-2.4.58.tar.gz
--2023-12-11 14:37:31--  https://downloads.apache.org/httpd/httpd-2.4.58.tar.gz
Resolving downloads.apache.org (downloads.apache.org)... 88.99.95.219, 135.181.214.104, 2a01:4f9:3a:2c57::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9825177 (9.4M) [application/x-gzip]
Saving to: ‘httpd-2.4.58.tar.gz’

httpd-2.4.58.ta 100%[=======>]   9.37M   837KB/s    in 11s     

2023-12-11 14:37:44 (853 KB/s) - ‘httpd-2.4.58.tar.gz’ saved [9825177/9825177]


创建用户
[root@zyq ~]#: useradd -r -M -s /sbin/nologin apache

安装依赖包
[root@zyq ~]#: yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ make vim
Last metadata expiration check: 0:06:27 ago on Mon 11 Dec 2023 02:34:25 PM CST.
Dependencies resolved.
================================================================
 Package             Arch   Version             Repo       Size
================================================================
Installing:
 expat-devel         x86_64 2.5.0-1.el9         appstream  53 k
 gcc                 x86_64 11.4.1-2.1.el9      appstream  32 M
......
  perl-vars-1.05-480.el9.noarch                                 
  vim-common-2:8.2.2637-20.el9_1.x86_64                         
  vim-enhanced-2:8.2.2637-20.el9_1.x86_64                       
  vim-filesystem-2:8.2.2637-20.el9_1.noarch                     

Complete!

解压软件包
[root@zyq ~]#: ls
anaconda-ks.cfg   apr-util-1.6.3.tar.gz
apr-1.7.4.tar.gz  httpd-2.4.58.tar.gz
[root@zyq ~]#: tar xf apr-1.7.4.tar.gz 
[root@zyq ~]#: tar xf apr-util-1.6.3.tar.gz 
[root@zyq ~]#: tar xf httpd-2.4.58.tar.gz 
[root@zyq ~]#: ls
anaconda-ks.cfg   apr-util-1.6.3         httpd-2.4.58.tar.gz
apr-1.7.4         apr-util-1.6.3.tar.gz
apr-1.7.4.tar.gz  httpd-2.4.58

修改configure文件
[root@zyq apr-1.7.4]#: vim configure
/cfgfile
    cfgfile="${ofile}T"
    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
    # $RM "$cfgfile"        //将此行加上注释,或者删除此行
    
进行编译
[root@zyq apr-1.7.4]#: ./configure --prefix=/usr/local/apr
[root@zyq apr-1.7.4]#: make && make install

[root@zyq apr-util-1.6.3]#:./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
.......
[root@zyq apr-util-1.6.3]#: make && make install

[root@zyq apr-util-1.6.3]#: cd ../httpd-2.4.58/
[root@zyq httpd-2.4.58]#: ./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=prefork
......
[root@zyq httpd-2.4.58]#: make && make install

安装后配置
[root@zyq ~]#: ls /usr/local/
apache  apr-util  etc    include  lib64    sbin   src
apr     bin       games  lib      libexec  share
[root@zyq ~]#: ls /usr/local/apache/
bin    cgi-bin  htdocs  include  man     modules
build  error    icons   logs     manual
[root@zyq ~]#: echo 'export PATH=/usr/local/apache/bin:$PATH'> /etc/profile.d/httpd.sh 
[root@zyq ~]#: ln -s /usr/local/apache/include/ /usr/include/apache
[root@zyq ~]#: vim /etc/man_db.conf 
MANDATORY_MANPATH                       /usr/local/apache/man

启动服务
[root@zyq ~]#: source /etc/profile.d/httpd.sh 
[root@zyq ~]#: ss -antl
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*          
LISTEN 0      128             [::]:22           [::]:*          
[root@zyq ~]#: apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fe92:c051%ens160. Set the 'ServerName' directive globally to suppress this message
[root@zyq ~]#: ss -antl
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*          
LISTEN 0      511                *:80              *:*          
LISTEN 0      128             [::]:22           [::]:*    

关闭防火墙
[root@zyq ~]#: systemctl disable --now firewalld.service 
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".
[root@zyq ~]#: setenforce 0
[root@zyq ~]#: vim /etc/selinux/config 

在这里插入图片描述

设置开机自启
[root@zyq apache]#: vim /usr/local/apache/conf/httpd.conf 
ServerName www.example.com:80  取消此行注释

[root@zyq apache]#: apachectl stop
[root@zyq apache]#: ss -antl
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*          
LISTEN 0      128             [::]:22           [::]:*          
修改配置文件
[root@zyq ~]#: cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/httpd.service
[root@zyq ~]#: vim /usr/lib/systemd/system/httpd.service
[root@zyq ~]#: cat /usr/lib/systemd/system/httpd.service
[Unit]
Description=OpenSSH 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@zyq ~]#: systemctl daemon-reload
[root@zyq ~]#: systemctl status httpd
○ httpd.service - OpenSSH server daemon
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; dis>
     Active: inactive (dead)

[root@zyq ~]#: systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@zyq ~]#: systemctl status httpd
● httpd.service - OpenSSH server daemon
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; ena>
     Active: active (running) since Mon 2023-12-11 15:45:24 CST>
    Process: 88201 ExecStart=/usr/local/apache/bin/apachectl st>
   Main PID: 88204 (httpd)
      Tasks: 1 (limit: 48715)
     Memory: 1.0M
        CPU: 12ms
     CGroup: /system.slice/httpd.service
             └─88204 /usr/local/apache/bin/httpd -k start

Dec 11 15:45:09 zyq systemd[1]: Starting OpenSSH server daemon.>
Dec 11 15:45:24 zyq apachectl[88203]: AH00558: httpd: Could not>
Dec 11 15:45:24 zyq systemd[1]: Started OpenSSH server daemon.

配置MySQL

安装依赖包
[root@zyq ~]#: yum -y install epel-release
[root@zyq ~]#: 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
......
Upgraded:
  zlib-1.2.11-40.el9.x86_64                                     
Installed:
  mariadb-connector-c-3.2.6-1.el9_0.x86_64                      
  mariadb-connector-c-config-3.2.6-1.el9_0.noarch               
  mariadb-connector-c-devel-3.2.6-1.el9_0.x86_64                
  mariadb-devel-3:10.5.16-2.el9.x86_64                          
  zlib-devel-1.2.11-40.el9.x86_64                               

Complete!
[root@zyq ~]#: rpm -qa | grep mariadb
mariadb-connector-c-config-3.2.6-1.el9_0.noarch
mariadb-connector-c-3.2.6-1.el9_0.x86_64
mariadb-connector-c-devel-3.2.6-1.el9_0.x86_64
mariadb-devel-10.5.16-2.el9.x86_64
[root@zyq ~]#: 
[root@zyq ~]#: yum -y install ncurses-devel openssl-devel openssl cmake 
......
Installed:
  cmake-3.20.2-8.el9.x86_64                                     
  cmake-data-3.20.2-8.el9.noarch                                
  cmake-filesystem-3.20.2-8.el9.x86_64                          
  cmake-rpm-macros-3.20.2-8.el9.noarch                          
  libuv-1:1.42.0-1.el9.x86_64                                   
  ncurses-c++-libs-6.2-10.20210508.el9.x86_64                   
  ncurses-devel-6.2-10.20210508.el9.x86_64                      

Complete!

创建用户
[root@zyq ~]#: useradd -r -M -s /sbin/nologin mysql
上传MySQL软件包
[root@zyq ~]#: ls
apr-util-1.6.3.tar.gz anaconda-ks.cfg   httpd-2.4.58
apr-1.7.4         httpd-2.4.58.tar.gz
apr-1.7.4.tar.gz  mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
apr-util-1.6.3
[root@zyq ~]#: tar xf mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz  -C /usr/local/
[root@zyq ~]#: cd /usr/local/
[root@zyq local]#: mv mysql-8.0.35-linux-glibc2.28-x86_64/ mysql
[root@zyq local]#: chown -R mysql.mysql mysql
[root@zyq local]#: ll
total 0
drwxr-xr-x. 14 root  root  164 Dec 11 15:34 apache
drwxr-xr-x.  6 root  root   58 Dec 11 14:53 apr
drwxr-xr-x.  5 root  root   43 Dec 11 14:59 apr-util
drwxr-xr-x.  2 root  root    6 May 16  2022 bin
drwxr-xr-x.  2 root  root    6 May 16  2022 etc
drwxr-xr-x.  2 root  root    6 May 16  2022 games
drwxr-xr-x.  2 root  root    6 May 16  2022 include
drwxr-xr-x.  2 root  root    6 May 16  2022 lib
drwxr-xr-x.  3 root  root   17 Dec  5 10:21 lib64
drwxr-xr-x.  2 root  root    6 May 16  2022 libexec
drwxr-xr-x.  9 mysql mysql 129 Dec 11 16:03 mysql
drwxr-xr-x.  2 root  root    6 May 16  2022 sbin
drwxr-xr-x.  5 root  root   49 Dec  5 10:21 share
drwxr-xr-x.  2 root  root    6 May 16  2022 src

设置环境变量
[root@zyq ~]#: echo 'export PATH=/usr/local/mysql/bin:$PATH'> /etc/profile.d/mysql.sh
[root@zyq ~]#: source /etc/profile.d/mysql.sh

创建数据存放路径
[root@zyq ~]#: mkdir /opt/data
[root@zyq ~]#: chown -R mysql.mysql /opt/data/

初始化数据库
[root@zyq bin]#: /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/data/
2023-12-11T08:13:04.906951Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.35) initializing of server in progress as process 94610
2023-12-11T08:13:04.921197Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-12-11T08:13:05.433632Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-12-11T08:13:06.985899Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: I(aToa#hd9g(
[root@zyq ~]#: echo 'I(aToa#hd9g(' > pass
[root@zyq ~]#: vim /etc/my.cnf
[root@zyq ~]#: 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
[client-server]

[root@zyq ~]#: ln -s /usr/local/mysql/include/ /usr/include/mysql
[root@zyq ~]#: vim /etc/ld.so.conf.d/mysql.conf
[root@zyq ~]#: cat /etc/ld.so.conf.d/mysql.conf 
/usr/local/mysql/lib

[root@zyq ~]#: ldconfig -v
ldconfig: Can't stat /libx32: No such file or directory
ldconfig: Path `/usr/lib' given more than once
(from <builtin>:0 and <builtin>:0)
ldconfig: Path `/usr/lib64' given more than once
(from <builtin>:0 and <builtin>:0)
ldconfig: Can't stat /usr/libx32: No such file or directory
/usr/local/mysql/lib: (from /etc/ld.so.conf.d/mysql.conf:1)
        libmysqlclient.so.21 -> libmysqlclient.so.21.2.35
/lib: (from <builtin>:0)
/lib64: (from <builtin>:0)
        libctf-nobfd.so.0 -> libctf-nobfd.so.0.0.0
        libbfd-2.35.2-42.el9.so -> libbfd-2.35.2-42.el9.s
        ......
[root@zyq ~]#: vim /etc/man_db.conf
#添加此行
MANDATORY_MANPATH                       /usr/local/mysql/man

[root@zyq ~]#: ls /usr/local/mysql/support-files/
mysqld_multi.server  mysql-log-rotate  mysql.server

指定路径
[root@zyq ~]#: vim /usr/local/mysql/support-files/mysql.server 
basedir=/usr/local/mysql
datadir=/opt/data

[root@zyq ~]#: /usr/local/mysql/support-files/mysql.server start
Starting MySQL.Logging to '/opt/data/zyq.err'.
. SUCCESS! 
[root@zyq ~]#: 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       70                   *:33060              *:*                                                                    
LISTEN 0       151                  *:3306               *:*                                                                    
LISTEN 0       511                  *:80                 *:*                                                                    
LISTEN 0       128               [::]:22              

设置开机自启
[root@lyx ~]# cp /usr/lib/systemd/system/sshd.service
/usr/lib/systemd/system/mysqld.service
[root@lyx ~]# vim /usr/lib/systemd/system/mysqld.service
[root@lyx ~]# cat /usr/lib/systemd/system/mysqld.service
[Unit]
Description=mysqld server daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/mysql/support-files/mysql.server start
ExecStop=/usr/local/mysql/support-files/mysql.server stop
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
[root@lyx ~]# systemctl daemon-reload
[root@lyx ~]# systemctl status mysqld
○ mysqld.service - mysqld server daemon
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; preset:
disabled)
Active: inactive (dead)

[root@zyq ~]#: systemctl enable --now mysqld.service 
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@zyq ~]#: systemctl status mysqld.service 
● mysqld.service
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; en>
     Active: active (running) since Mon 2023-12-11 16:46:02 CST>
    Process: 95768 ExecStart=/usr/local/mysql/support-files/mys>
   Main PID: 95785 (mysqld_safe)
      Tasks: 39 (limit: 48715)
     Memory: 368.6M
        CPU: 490ms
     CGroup: /system.slice/mysqld.service
             ├─95785 /bin/sh /usr/local/mysql/bin/mysqld_safe ->
             └─95975 /usr/local/mysql/bin/mysqld --basedir=/usr>

Dec 11 16:46:01 zyq systemd[1]: Starting mysqld.service...
Dec 11 16:46:02 zyq mysql.server[95768]: Starting MySQL. SUCCES>
Dec 11 16:46:02 zyq systemd[1]: Started mysqld.service.
lines 1-15/15 (END)

修改密码
[root@zyq ~]#: cat pass
I(aToa#hd9g(
[root@zyq ~]#: mysql -uroot -p'I(aToa#hd9g('
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 'Pssword@_'
    -> ;
Query OK, 0 rows affected (0.00 sec)

安装php

https://www.php.net/distributions/php-8.3.3.tar.gz
[root@zyq ~]#: wget https://www.php.net/distributions/php-8.3.0.tar.xz
--2023-12-11 17:41:20--  https://www.php.net/distributions/php-8.3.0.tar.xz
Resolving www.php.net (www.php.net)... 185.85.0.29, 2a02:cb40:200::1ad
Connecting to www.php.net (www.php.net)|185.85.0.29|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12431612 (12M) [application/octet-stream]
Saving to: ‘php-8.3.0.tar.xz’

php-8.3.0.tar.x 100%[=======>]  11.86M   549KB/s    in 19s     

2023-12-11 17:41:41 (624 KB/s) - ‘php-8.3.0.tar.xz’ saved [12431612/12431612]

[root@zyq ~]#: tar xf php-8.3.0.tar.xz 
[root@zyq ~]#: 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
pass
php-8.3.0
php-8.3.0.tar.xz
[root@zyq ~]#: cd php-8.3.0/
[root@zyq php-8.3.0]#: ls
appveyor             ext                  sapi
benchmark            EXTENSIONS           scripts
build                LICENSE              SECURITY.md
buildconf            main                 tests
buildconf.bat        NEWS                 travis
CODEOWNERS           pear                 TSRM
CODING_STANDARDS.md  php.ini-development  UPGRADING
configure            php.ini-production   UPGRADING.INTERNALS
configure.ac         README.md            win32
CONTRIBUTING.md      README.REDIST.BINS   Zend
docs                 run-tests.php

安装以来环境
[root@zyq ~]#: yum -y install epel-release
[root@zyq ~]#: 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 php-mysqlnd

[root@zyq ~]#: yum -y install libsqlite3x-devel libzip-devel
Last metadata expiration check: 0:10:18 ago on Mon 11 Dec 2023 08:06:23 PM CST.
Dependencies resolved.
================================================================
 Package            Arch    Version            Repository  Size
================================================================
Installing:
 libsqlite3x-devel  x86_64  20071018-31.el9    epel       134 k
......
pgraded:
  sqlite-libs-3.34.1-6.el9_1.x86_64                             
Installed:
  libsqlite3x-20071018-31.el9.x86_64                            
  libsqlite3x-devel-20071018-31.el9.x86_64                      
  sqlite-3.34.1-6.el9_1.x86_64                                  
  sqlite-devel-3.34.1-6.el9_1.x86_64                            

Complete!

[root@zyq ~]#: wget https://dl.rockylinux.org/pub/rocky/9/devel/x86_64/os/Packages/o/oniguruma-devel-6.9.6-1.el9.5.x86_64.rpm

[root@zyq ~]#: cd /etc/yum.repos.d/
[root@zyq yum.repos.d]#: vim 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         打开,将0该为1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
......

[root@zyq yum.repos.d]#: yum list all | grep oniguruma-devel
oniguruma-devel.x86_64                                                                   6.9.6-1.el9.5                                  devel              
[root@zyq yum.repos.d]#: yum -y install oniguruma-devel

编译
[root@zyq ~]#: cd php-8.3.0/
[root@zyq 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

[root@zyq php-8.3.0]#: make -j2
......
[root@zyq php-8.3.0]#: make install
......

安装完成后设置环境变量
[root@zyq php-8.3.0]#: ls /usr/local/php8/
bin  etc  include  lib  php  sbin  var
[root@zyq local]#: echo 'export PATH=/usr/local/php8/bin:/usr/local/php8/sbin:$PATH'> /etc/profile.d/php.sh
[root@zyq php-8.3.0]#: source /etc/profile.d/php.sh 

[root@zyq php-8.3.0]#: ln -s /usr/local/php8/include/ /usr/include/php
[root@zyq php-8.3.0]#: vim /etc/ld.so.conf.d/php.conf
[root@zyq php-8.3.0]#: cat /etc/ld.so.conf.d/php.conf
/usr/local/php8/lib
[root@zyq php-8.3.0]#: ldconfig -v
ldconfig: Can't stat /libx32: No such file or directory
ldconfig: Path `/usr/lib' given more than once
(from <builtin>:0 and <builtin>:0)
ldconfig: Path `/usr/lib64' given more than once
(from <builtin>:0 and <builtin>:0)
ldconfig: Can't stat /usr/libx32: No such file or directory
/usr/local/mysql/lib: (from /etc/ld.so.conf.d/mysql.conf:1)
        libmysqlclient.so.21 -> libmysqlclient.so.21.2.35
/usr/local/php8/lib: (from /etc/ld.so.conf.d/php.conf:1)
......

[root@zyq local]#: which php
/usr/local/php8/bin/php
[root@zyq local]#: php -v
PHP 8.3.0 (cli) (built: Dec 11 2023 20:53:14) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies

修该配置文件
[root@zyq php-8.3.0]#: pwd
/root/php-8.3.0
[root@zyq php-8.3.0]#: ls
appveyor             EXTENSIONS           README.md
benchmark            include              README.REDIST.BINS
build                libs                 run-tests.php
buildconf            libtool              sapi
buildconf.bat        LICENSE              scripts
CODEOWNERS           main                 SECURITY.md
CODING_STANDARDS.md  Makefile             tests
config.log           Makefile.fragments   travis
config.nice          Makefile.objects     TSRM
config.status        modules              UPGRADING
configure            NEWS                 UPGRADING.INTERNALS
configure.ac         pear                 win32
CONTRIBUTING.md      php.ini-development  Zend
docs                 php.ini-production
ext                  php.sh
[root@zyq php-8.3.0]#: cp php.ini-production /etc/php.ini
cp: overwrite '/etc/php.ini'? y

配置php-fpm
[root@zyq php-8.3.0]#: mkdir /etc/init.d
[root@zyq php-8.3.0]#: cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@zyq php-8.3.0]#: ll /etc/init.d/
total 4
-rw-r--r--. 1 root root 2402 Dec 11 21:19 php-fpm
[root@zyq ~]#: chmod +x /etc/init.d/php-fpm 

[root@zyq etc]#: cd /usr/local/php8/
[root@zyq php8]#: ls
bin  etc  include  lib  php  sbin  var
[root@zyq php8]#: cd  etc/
[root@zyq etc]#: ls
pear.conf  php-fpm.conf.default  php-fpm.d
[root@zyq etc]#: cp php-fpm.conf.default php-fpm.conf
[root@zyq etc]#: ls
pear.conf  php-fpm.conf  php-fpm.conf.default  php-fpm.d
[root@zyq etc]#: cd php-fpm.d/
[root@zyq php-fpm.d]#: ls
www.conf.default
[root@zyq php-fpm.d]#: cp www.conf.default  www.conf
[root@zyq php-fpm.d]#: ls
www.conf  www.conf.default
[root@zyq php-fpm.d]#: cd
[root@zyq ~]#: service php-fpm start 
Starting php-fpm  done
[root@zyq ~]#: ss -antl
State  Recv-Q  Send-Q   Local Address:Port    Peer Address:Port Process                                                         
LISTEN 0       4096         127.0.0.1:9000         0.0.0.0:*                                                                    
LISTEN 0       128            0.0.0.0:22           0.0.0.0:*                                                                    
LISTEN 0       70                   *:33060              *:*                                                                    
LISTEN 0       151                  *:3306               *:*                                                                    
LISTEN 0       511                  *:80                 *:*                                                                    
LISTEN 0       128               [::]:22              [::]:*                                                                    
[root@zyq ~]#: service php-fpm stop
Gracefully shutting down php-fpm . done


设置开机自启
[root@zyq ~]#: cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/php-fpm.service
[root@zyq ~]#: vim /usr/lib/systemd/system/php-fpm.service
[root@zyq ~]#: cat /usr/lib/systemd/system/php-fpm.service
[Unit]
Description=OpenSSH server daemon
After=network.target 

[Service]
Type=forking
ExecStart=service php-fpm start
ExecStop=service php-fpm stop
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@zyq ~]#: systemctl daemon-reload
[root@zyq ~]#: systemctl status php-fpm.service 
○ php-fpm.service - OpenSSH server daemon
     Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; e>
     Active: inactive (dead)

Dec 11 21:40:51 zyq systemd[1]: php-fpm.service: Service has mo>
Dec 11 21:41:59 zyq systemd[1]: php-fpm.service: Service has mo>

[root@zyq ~]#: systemctl enable --now  php-fpm  
[root@zyq ~]#: systemctl status php-fpm
● php-fpm.service - OpenSSH server daemon
     Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; e>
     Active: active (running) since Mon 2023-12-11 21:43:40 CST>
    Process: 251800 ExecStart=service php-fpm start (code=exite>
   Main PID: 251806 (php-fpm)
      Tasks: 3 (limit: 48715)
     Memory: 7.2M
        CPU: 30ms
     CGroup: /system.slice/php-fpm.service
             ├─251806 "php-fpm: master process (/usr/local/php8>
             ├─251807 "php-fpm: pool www"
             └─251808 "php-fpm: pool www"

Dec 11 21:43:40 zyq systemd[1]: Starting OpenSSH server daemon.>
Dec 11 21:43:40 zyq service[251804]: Starting php-fpm  done
Dec 11 21:43:40 zyq systemd[1]: Started OpenSSH server daemon.
...skipping...
● php-fpm.service - OpenSSH server daemon
     Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; e>
     Active: active (running) since Mon 2023-12-11 21:43:40 CST>
    Process: 251800 ExecStart=service php-fpm start (code=exite>
   Main PID: 251806 (php-fpm)
      Tasks: 3 (limit: 48715)
     Memory: 7.2M
        CPU: 30ms
     CGroup: /system.slice/php-fpm.service
             ├─251806 "php-fpm: master process (/usr/local/php8>
             ├─251807 "php-fpm: pool www"
             └─251808 "php-fpm: pool www"

Dec 11 21:43:40 zyq systemd[1]: Starting OpenSSH server daemon.>
Dec 11 21:43:40 zyq service[251804]: Starting php-fpm  done
Dec 11 21:43:40 zyq systemd[1]: Started OpenSSH server daemon.

[root@zyq ~]#: ss -antl
State  Recv-Q  Send-Q   Local Address:Port    Peer Address:Port Process                                                         
LISTEN 0       4096         127.0.0.1:9000         0.0.0.0:*                                                                    
LISTEN 0       128            0.0.0.0:22           0.0.0.0:*                                                                    
LISTEN 0       70                   *:33060              *:*                                                                    
LISTEN 0       151                  *:3306               *:*                                                                    
LISTEN 0       511                  *:80                 *:*                                                                    
LISTEN 0       128               [::]:22              [::]:*    
配置apache
[root@zyq ~]#: sed -i '/proxy_module/s/#//g' /usr/local/apache/conf/httpd.conf
[root@zyq ~]#: sed -i '/proxy_fcgi_module/s/#//g' /usr/local/apache/conf/httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
取消上面两行注释启用httpd的相关模块


[root@zyq ~]#: cd /usr/local/apache
[root@zyq apache]#: ls
bin    cgi-bin  error   icons    logs  manual
build  conf     htdocs  include  man   modules
[root@zyq apache]#: cd htdocs/
[root@zyq htdocs]#: ls
index.html


创建测试web页面
[root@zyq htdocs]#: mkdir test
[root@zyq htdocs]#: cd test/
[root@zyq test]#: vim index.php
[root@zyq test]#: cat index.php 
<?php
    phpinfo();
?>

[root@zyq test]#: vim /usr/local/apache/conf/httpd.conf 
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
Include conf/extra/vhosts.conf             #加入此行

[root@zyq test]#: vim /usr/local/apache/conf/extra/vhosts.conf
[root@zyq extra]#: cat /usr/local/apache/conf/extra/vhosts.conf 
<VirtualHost *:80>
    DocumentRoot "/usr/local/apache/htdocs/test"
    ServerName www.zyq.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>  

[root@zyq ~]#: vim /usr/local/apache/conf/httpd.conf 
//搜索AddType,添加以下内容
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php        #添加此行
    AddType application/x-httpd-php-source .phps        #添加此行
<IfModule dir_module>
    DirectoryIndex index.html index.php  加上index.php
</IfModule>    
  
重启服务
[root@zyq ~]#: systemctl restart httpd.service 
[root@zyq ~]#: systemctl restart php-fpm.service 
[root@zyq ~]#: ss -antl
State  Recv-Q  Send-Q   Local Address:Port    Peer Address:Port Process                                                         
LISTEN 0       4096         127.0.0.1:9000         0.0.0.0:*                                                                    
LISTEN 0       128            0.0.0.0:22           0.0.0.0:*                                                                    
LISTEN 0       70                   *:33060              *:*                                                                    
LISTEN 0       151                  *:3306               *:*                                                                    
LISTEN 0       511                  *:80                 *:*                                                                    

关闭防火墙访问php测试页面

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

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

相关文章

快递批量查询神器:一键解锁物流数据,高效管理轻松实现!

在这个信息爆炸的时代&#xff0c;拥有「多维度快递查询分析工具」&#xff0c;就意味着拥有了洞悉市场脉动的能力。让您的商业决策更加明智&#xff0c;让您的企业在竞争中脱颖而出。现在就加入我们的行列吧&#xff01;一键掌握物流数据&#xff0c;洞悉市场脉动&#xff0c;…

npm下载慢换国内镜像地址

1 设置淘宝镜像地址 npm config set registry http://registry.npm.taobao.org 2 查看当前下载地址 npm config get registry 3 其它镜像地址列表&#xff1a; 1. 官方镜像&#xff1a;https://registry.npmjs.org/ 2. 淘宝镜像&#xff1a;https://registry.npm.taobao.o…

【渗透测试】

渗透测试 一、kali信息搜集1、端口扫描常见的端口服务工具&#xff1a; 2、目录扫描工具&#xff1a; 3、CMS系统指纹识别工具&#xff1a; 4、资产收集工具 二、kali漏洞利用1、漏洞数据库2、漏洞扫描工具商业漏洞扫描工具免费漏洞扫描工具国产商业漏洞扫描产品 3、msf反弹连接…

Django验证码(二)

一、生成图片 1.1、说明 通过pillow模板库生成图片,步骤如下 安装pillow模板建立 生成验证码内容 方法建立 生成验证码颜色 方法建立 生成验证码 方法1.2、需要安装 Pillow 库 pip install Pillow==9.3.01.3、生成验证码内容 import randomdef random_str(length=4):"…

HTTPS协议原理

文章目录 1. 什么是https2. 什么是加密3. 为什么要加密3. 常见的加密方式3.1 对称加密3.2 非对称加密 4. 数据指纹5. https工作过程5.1 加密方案5.2 引入证书5.3 完整流程 1. 什么是https 网络协议栈当中&#xff0c;传输层和网络层是在操作系统内部&#xff0c;应用层的请求是…

多站合一的音乐搜索下载助手PHP源码l亲测

源码获取方式 回复&#xff1a;031601 搭建教程&#xff1a; 将源码下载上传至宝塔面板&#xff0c;直接运行即可~ 说明&#xff1a; 该源码进行测试&#xff0c;测试成功源码无加密优化相关其他采集问题。

MySQL语法分类 DQL(1)基础查询

//语法 select 字段列表 from 表名列表 where条件列表 group by分组字段 having 分组后的条件 order by排序 limit 分页限定为了更好的学习这里给出基本表数据用于查询操作 create table student (id int, name varchar(20), age int, sex varchar(5),address varchar(100),ma…

白话模电:3.三极管(考研面试与笔试常考问题)

一、三极管的简单判断 1.判断三极 1)给了图 左边是b,有箭头是e,剩下是c 2)给了电位 b:中间值&#xff0c;e:较近值(离中间值)&#xff0c;c:较远值(离中间值) 2.判断流向 bc同向(共同流向“|”或共同流离“|”)&#xff0c;e与bc反向 3.判断材料 4.判断类型 5.判断能否构…

261:vue+openlayers 使用setRotation旋转地图

第261个 点击查看专栏目录 本示例介绍演示如何在vue+openlayers中使用setRotation旋转地图。setRotation是view的一个方法,旋转的内容是弧度,这里设置的角度需要将其换算为弧度,即 x*Math.PI/180. 直接复制下面的 vue+openlayers源代码,操作2分钟即可运行实现效果 文章目…

分享一篇Oracle RAC实战安装11G

分享一次很久以前的Oracle rac项目实施。 1、拓扑结构 基础环境是2台H3C的服务器2台3PAR的双活存储&#xff0c;操作系统centos7.2。借用下别人家的拓扑先&#xff08;这是一套典型的RAC架构&#xff09;。 2、网卡TEAM操作 以eno51和en052组成Team1组为示例&#xff1a; nm…

Tengine编译安装

首先下载源码 可以去官网&#xff1a;The Tengine Web Server 当前最新版地址&#xff1a;https://tengine.taobao.org/download/tengine-3.1.0.tar.gz 安装编译依赖 yum -y install gcc pcre-devel zlib-devel openssl-devel libxml2-devel \libxslt-devel gd-devel GeoIP…

如何在Windows系统搭建Emby影音平台并实现远程访问本地文件【内网穿透】

文章目录 1.前言2. Emby网站搭建2.1. Emby下载和安装2.2 Emby网页测试 3. 本地网页发布3.1 注册并安装cpolar内网穿透3.2 Cpolar云端设置3.3 Cpolar内网穿透本地设置 4.公网访问测试5.结语 1.前言 在现代五花八门的网络应用场景中&#xff0c;观看视频绝对是主力应用场景之一&…

AI - 支持向量机算法

&#x1f9e8;概念 支持向量机&#xff08;Support Vector Machine, SVM&#xff09;是一种强大的机器学习算法&#xff0c;主要用于解决二分类问题。 SVM的核心思想是找到一个超平面&#xff0c;这个超平面能够最好地将数据分为两类&#xff0c;即在保证分类准确的情况下&am…

android studio 连接mumu模拟器调试

1、打开mumu模拟器 2、在Android Studio 中 控制台 cd 到 sdk 目录下 platform-tools 文件夹&#xff0c;有一个adb.exe 可运行程序 一般指令&#xff1a; adb connect 127.0.0.1:7555 但是这个执行在window环境下可能会报错 解决方法是在 adb 之前加 ".\", 问题…

大模型学习笔记(一):部署ChatGLM模型以及stable-diffusion模型

大模型学习笔记&#xff08;一&#xff09;&#xff1a;部署ChatGLM模型以及stable-diffusion模型 注册算力平台&#xff08;驱动云平台&#xff09;1.平台注册2.查看算力3.进入平台中心 部署ChatGLM3-6B模型1.创建项目2.配置环境设置镜像源、克隆项目修改requirements 3.修改w…

Hive SQL必刷练习题:同时在线人数问题(*****)

问题描述&#xff1a; 思路&#xff1a; ​ 因为有进直播间时间&#xff0c;和出直播间人数。所以我可以统计&#xff0c;进来一个是不是人数就会加1&#xff0c;出去一个&#xff0c;人数就会减1。 ​ 所以可以给进直播间的时间标记一个1&#xff0c;出直播间的时间标记一个…

柚见第十二期(随机匹配)

随机匹配 目的 为了帮大家更快地发现和自己兴趣相同的朋友 问题 匹配 1 个还是匹配多个&#xff1f; 答&#xff1a;匹配多个&#xff0c;并且按照匹配的相似度从高到低排序 怎么匹配&#xff1f;&#xff08;根据什么匹配&#xff09; 答&#xff1a;标签 tags 还可以根据 us…

【数据可视化】使用Python + Gephi,构建中医方剂关系网络图!

代码和示例数据下载 前言 在这篇文章中&#xff0c;我们将会可视化 《七版方剂学》 的药材的关系&#xff0c;我们将使用Python制作节点和边的数据&#xff0c;然后在Gephi中绘制出方剂的网络图。 Gephi是一个专门用于构建网络图的工具&#xff0c;只要你能提供节点和边的数…

Microsoft Word 符号 / 特殊符号

Microsoft Word 符号 / 特殊符号 1. 插入 -> 符号 -> 其他符号 -> Wingdings 2References 1. 插入 -> 符号 -> 其他符号 -> Wingdings 2 ​ References [1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/

Android FrameWork 学习路线

目录 前言 学习路线&#xff1a; 1.基础知识 2、AOSP 源码学习 3. AOSP 源码编译系统 4. Hal与硬件服务 5.基础组件 6. Binder 7. 系统启动过程分析 8. 应用层框架​编辑 9. 显示系统 10. Android 输入系统 11. 系统应用 前言 Android Framework 涉及的行业相当广…