源码编译部署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 kgcc                 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
/cfgfilecfgfile="${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 daemonLoaded: 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 daemonLoaded: 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.0MCPU: 12msCGroup: /system.slice/httpd.service└─88204 /usr/local/apache/bin/httpd -k startDec 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.0libbfd-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.serviceLoaded: 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.6MCPU: 490msCGroup: /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.35Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> alter user 'root'@'localhost' identified with mysql_native_password by '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 daemonLoaded: 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 daemonLoaded: 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.2MCPU: 30msCGroup: /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 daemonLoaded: 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.2MCPU: 30msCGroup: /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 
<?phpphpinfo();
?>[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.comProxyRequests OffProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/test/$1<Directory "/usr/local/apache/htdocs/test">Options noneAllowOverride noneRequire all granted</Directory>
</VirtualHost>  [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 .ZAddType application/x-gzip .gz .tgzAddType 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测试页面

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

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

相关文章

基于Springboot和Redis实现的在线选课系统

1.项目简介 1.1 介绍 毕业设计真的就是demo吗&#xff1f;作为工作前的最后一个校园项目&#xff0c;毕业设计应当尽可能的贴近企业实战&#xff0c;业务不必很复杂&#xff0c;但要做到麻雀虽小五脏俱全。本期学长跟大家一起分享如何开发一个在线选课系统&#xff0c;需求也…

从汇编来角度剖析C语言函数调用过程

C基础专栏&#xff1a;http://t.csdnimg.cn/WcEhj 目录 1.引言 2.寄存器 3.栈帧 4.函数调用前调用者的动作 5.被调用者在函数调用后的动作 6.被调用者返回前的动作 7.调用者在返回后的动作 8.总结 1.引言 当一个c函数被调用时&#xff0c;一个栈帧(stack frame)是如何被…

迁移学习怎么用

如果想实现一个计算机视觉应用&#xff0c;而不想从零开始训练权重&#xff0c;比方从随机初始化开始训练&#xff0c;更快的方式是下载已经训练好权重的网络结构&#xff0c;把这个作为预训练&#xff0c;迁移到你感兴趣的新任务上。ImageNet、PASCAL等等数据库已经公开在线。…

8:00面试,8:06就出来了,问的问题有点变态。。。

从小厂出来&#xff0c;没想到在另一家公司又寄了。 到这家公司开始上班&#xff0c;加班是每天必不可少的&#xff0c;看在钱给的比较多的份上&#xff0c;就不太计较了。没想到9月一纸通知&#xff0c;所有人不准加班&#xff0c;加班费不仅没有了&#xff0c;薪资还要降40%…

Springboot项目部署

1、Sping路径不需要有项目名&#xff0c;因为Springboot内置了tomcat&#xff0c;一个tomcat下面就部署了当前这一个项目&#xff0c;如果想要部署多个项目就要启动多个tomcat &#xff08;1&#xff09;一个项目多个端口 填写想要开的端口号 &#xff08;2&#xff09;部署多…

字符分类函数(iscntrl、i是space.....)---c语言

目录 一、定义二、字符分类函数2.1 -iscntrl&#xff08;&#xff09;2.1.1定义2.1.2使用举例 2.2 -isspace&#xff08;&#xff09;2.2.1描述2.2.2使用举例 2.3-isdigit()2.3.1描述2.3.2使用举例 2.4-isxdigit()2.4.1描述 2.5-islower()2.5.1描述2.5.2使用举例 2.6-isupper()…

Java基础夯实【进阶】——八股文【2024面试题案例代码】

1、Java当中什么是线程和进程 在Java中&#xff0c;线程和进程是两个非常重要的概念。进程可以被视为一个执行中的程序的实例&#xff0c;它拥有自己的内存空间和系统资源。而线程则是进程中的一个实体&#xff0c;由进程创建&#xff0c;并允许程序在同一时刻执行多个任务。J…

决策树 | 分类树回归树:算法逻辑

目录 一. 决策树(Decision Tree)1. 决策树的构建1.1 信息熵(Entropy)1.1.1 信息量&信息熵 定义1.1.2 高信息熵&低信息熵 定义1.1.3 信息熵 公式 1.2 信息增益(Information Gain)1.2.1 信息增益的计算1.2.2 小节 2. 小节2.1 算法分类2.2 决策树算法分割选择2.3 决策树算…

MechanicalSoup,一个非常实用的 Python 自动化浏览器交互工具库!

目录 前言 什么是 Python MechanicalSoup 库&#xff1f; 核心功能 使用方法 1. 安装 MechanicalSoup 库 2. 创建 MechanicalSoup 客户端 3. 打开网页并与之交互 实际应用场景 1. 网页自动化测试 2. 网络爬虫与数据提取 3. 网页自动化操作 4. 自动化填写和提交多个表单 5.…

柚见十三期(优化)

前端优化 加载匹配功能与加载骨架特效 骨架屏 : vant-skeleton index.vue中 /** * 加载数据 */ const loadData async () > { let userListData; loading.value true; //心动模式 if (isMatchMode.value){ const num 10;//推荐人数 userListData await myA…

django-comment-migrate 模型注释的使用

django-comment-migrate 的使用 django-comment-migrate 是一个 Django 应用&#xff0c;用于将模型注释自动迁移到数据库表注释中。它可以帮助您保持数据库表注释与模型定义的一致性&#xff0c;并提高代码的可读性。 安装 要使用 django-comment-migrate&#xff0c;您需要…

线程是如何在 6 种状态之间转换的

线程是如何在 6 种状态之间转换的 线程的 6 种状态New 新创建Runnable 可运行阻塞状态Blocked 被阻塞Waiting 等待Timed Waiting 限期等待 注意点 主要学习线程是如何在 6 种状态之间转换。 线程的 6 种状态 就像生物从出生到长大、最终死亡的过程一样&#xff0c;线程也有自己…

搭建Hadoop3.x完全分布式集群

零、资源准备 虚拟机相关&#xff1a; VMware workstation 16&#xff1a;虚拟机 > vmware_177981.zipCentOS Stream 9&#xff1a;虚拟机 > CentOS-Stream-9-latest-x86_64-dvd1.iso Hadoop相关 jdk1.8&#xff1a;JDK > jdk-8u261-linux-x64.tar.gzHadoop 3.3.6&am…

Netty架构详解

文章目录 概述整体结构Netty的核心组件逻辑架构BootStrap & ServerBootStrapChannelPipelineFuture、回调和 ChannelHandler选择器、事件和 EventLoopChannelHandler的各种ChannelInitializer类图 Protocol Support 协议支持层Transport Service 传输服务层Core 核心层模块…

第七节:Vben Admin权限-后端获取路由和菜单

系列文章目录 第一节:Vben Admin介绍和初次运行 第二节:Vben Admin 登录逻辑梳理和对接后端准备 第三节:Vben Admin登录对接后端login接口 第四节:Vben Admin登录对接后端getUserInfo接口 第五节:Vben Admin权限-前端控制方式 第六节:Vben Admin权限-后端控制方式 第七节…

Unity2019.2.x 导出apk 安装到安卓Android12+及以上的系统版本 安装出现-108 安装包似乎无效的解决办法

Unity2019.2.x 导出apk 安装到安卓Android12及以上的系统版本 安装出现-108 安装包似乎无效的解决办法 导出AndroidStudio工程后 需要设置 build.gradle文件 // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAINbuildscript {repositor…

河马优化算法(HO)-2024年Nature子刊新算法 公式原理详解与性能测评 Matlab代码免费获取

声明&#xff1a;文章是从本人公众号中复制而来&#xff0c;因此&#xff0c;想最新最快了解各类智能优化算法及其改进的朋友&#xff0c;可关注我的公众号&#xff1a;强盛机器学习&#xff0c;不定期会有很多免费代码分享~ 目录 原理简介 一、种群初始化 二、河马在河流或…

【Python编程基础】第一节.Python基本语法(上)

文章目录 前言⼀、Python介绍二、Python环境配置三、Pycharm 书写代码四、Python基本语法 4.1 print 函数的简单使用 4.2 注释 4.3 Python 代码中三种波浪线和 PEP8 4.4 在 cmd 终端中运⾏ Python 代码 4.5 变量 4.6 数据类型 4.7 类型转换…

Python使用openpyxl库或pandas库创建.xlsx格式的Excel文件,并向文件不同的sheet按行或按列写入内容

import openpyxl# 创建-一个Workbook对象 wb openpyxl.Workbook()# 创建多个工作表 sheet1 wb.active sheet1.title "s1"sheet2 wb.create_sheet("s2")# 在不同的工作表中写入数据 sheet1["A1"] Data for Sheet1 sheet1["A2"] D…

HCIP—BGP邻居关系建立实验

BGP的邻居称为&#xff1a;IBGP对等体 EBGP对等体 1.EBGP对等体关系&#xff1a; 位于 不同自治系统 的BGP路由器之间的BGP对等体关系 EBGP对等体一般使用 直连建立 对等体关系&#xff0c;EBGP邻居之间的报文 TTL中值设置为1 两台路由器之间建立EBGP对等体关系&#xff0…