源码编译部署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.mzph.cn/news/750977.shtml

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

相关文章

BUUCTF-WEB1

[ACTF2020 新生赛]Exec1 1.打开靶机 是一个ping命令 2.利用管道符“|” ping一下本地主机并查看ls ping 127.0.0.1 | ls 可以看到回显的内容是一个文件 127.0.0.1 | cat index.php #查看主机下index.php 127.0.0.1 | ls / #查看主机根目录下的文件 看的一个flag文件 …

数据仓库数据分层详解

数据仓库中的数据分层是一种重要的数据组织方式&#xff0c;其目的是为了在管理数据时能够对数据有一个更加清晰的掌控。以下是数据仓库中的数据分层详解&#xff1a; 原始数据层&#xff08;Raw Data Layer&#xff09;&#xff1a;这是数仓中最底层的层级&#xff0c;用于存…

jupyter闪退和自动跳转问题

1.闪退问题 当我们点击jupyter时&#xff0c;它会闪一下&#xff0c;然后无法进入&#xff0c;这个时候我们可以去prompt命令行输入jupyter notebook启动试试&#xff0c;如果还不行&#xff0c;我们可以根据报错去解决&#xff0c;一般csdn上都有对应情况&#xff0c;直接搜索…

Linux-新手小白速秒Hadoop集群全生态搭建(图文混编超详细)

在之前的文章中&#xff0c;我教会大家如何一步一步搭建一个Hadoop集群&#xff0c;但是只提供了代码&#xff0c;怕有些朋友会在一些地方产生疑惑&#xff0c;今天我来以图文混排的方式&#xff0c;一站式交给大家如何搭建一个Hadoop高可用集群包括&#xff08;HadoopHA&#…

el-select使用filterable下拉无法关闭得问题

这里推荐一个前端框架 sakuya / SCUI&#xff0c;他里面有个formTable&#xff0c;可以解决很多订单明细保存得问题。基本沿用element-plus的前端使用模式&#xff0c;让表单表格变的非常容易。 这个的供应商插件&#xff0c;当使用filterable后&#xff0c;点击表格重的选项&…

Redis Desktop Manager:一站式Redis数据库管理与优化

Redis Desktop Manager是一款功能强大的Redis桌面管理工具&#xff0c;也被称作Redis可视化工具。以下是其主要的功能特色&#xff1a; 连接管理&#xff1a;Redis Desktop Manager支持连接多个Redis服务器&#xff0c;用户可以在同一界面下管理多个数据库&#xff0c;大大提高…

记录一下在Pycharm中虚拟环境的创建

如果在Pycharm中要新建一个虚拟环境&#xff0c;那你可以在Terminal中选择Command Prompt&#xff0c;在这里面执行相关命令 一、安装了Anaconda&#xff0c;创建虚拟环境 当你使用解释器是Anaconda提供的时&#xff0c;你可以使用conda命令执行&#xff0c;见以下操作&#x…

前端Vue与uni-app中的九宫格、十二宫格和十五宫格菜单组件实现

在前端 Vue 开发中&#xff0c;我们经常会遇到需要开发九宫格、十二宫格和十五宫格菜单按钮的需求。这些菜单按钮通常用于展示不同的内容或功能&#xff0c;提供给用户快速访问和选择。 一、引言 在前端开发中&#xff0c;九宫格、十二宫格和十五宫格菜单按钮是一种常见的布局…

202206 CSP认证 | 角色授权

角色授权 fine&#xff0c;又是一道acwing上TLE但是平台通过了的&#xff0c;那就酱吧… 直接跟着题目来模拟的…先找到每个用户授予的所有角色&#xff0c;包括用户本身和它所属的用户组。 然后遍历这个角色集合&#xff0c;看是否有操作权限&#xff0c;种类权限以及资源名称…

SVN修改已提交版本的注释

目录 一、需求分析 二、问题分析 三、解决办法 一、需求分析 ​开发过程中&#xff0c;在SVN提交文件后&#xff0c;发现注释写的不完整或不够明确&#xff0c;想再修改之前的注释文字​。 使用环境&#xff1a; SVN服务器操作系统&#xff1a;Ubuntu 20.04.6 LTS SVN版本&…

JVM实战篇

内存调优 内存溢出和内存泄漏 内存泄漏&#xff1a;在java中如果不再使用一个对象&#xff0c;但是该对象依然在GC ROOT的引用链上&#xff0c;这个对象就不会被垃圾回收器回收。 内存泄漏绝大多数情况都是由堆内存泄漏引起的&#xff0c;所以后续没有特别说明则讨论的都是堆…

Linux-centos如何搭建yum源仓库

1.本地搭建&#xff08;无需连接外网&#xff09; 1.1检查网络配置&#xff0c;及网络连接 打开虚拟机&#xff0c;点击【编辑——虚拟网络编辑器】 点击【仅主机模式】查看子网段是否和局内IP匹配 进入局内&#xff0c;查看网络IP是否在你上述设置的网段内&#xff0c;如果不…

Chapter 13 Techniques of Design-Oriented Analysis: The Feedback Theorem

Chapter 13 Techniques of Design-Oriented Analysis: The Feedback Theorem 从这一章开始讲负反馈Control系统和小信号建模. 13.2 The Feedback Theorem 首先介绍 Middlebrook’s Feedback Theorem 考虑下面负反馈系统 传输函数 Guo/ui G ( s ) u o u i G ∞ T 1 T G…

1.实用Qt:解决绘制圆角边框时,圆角锯齿问题

目录 问题描述 解决方案 方案1&#xff1a; 方案2&#xff1a; 结果示意图 问题描述 做UI的时候&#xff0c;我们很多时候需要给绘制一个圆角边框&#xff0c;初识Qt绘制的童鞋&#xff0c;可能绘制出来的圆角边框很是锯齿&#xff0c;而且粗细不均匀&#xff0c;如下图&…

Vue | 使用 ECharts 绘制折线图

目录 一、安装和引入 ECharts 二、使用 ECharts 2.1 新增 div 盒子 2.2 编写画图函数 2.3 完整代码结构 三、各种小问题 3.1 函数调用问题 3.2 数据格式问题 3.3 坐标轴标签问题 3.4 间隔显示标签 参考博客&#xff1a;Vue —— ECharts实现折线图 本文是在上…

JVM学习-JVM简介以及其内部结构

目录 1.什么是JVM 2.JVM、JRE、JDK、JavaSE、JavaEE之间的联系 3.JVM的内部结构 4.各部分的作用 4.1 类加载器 4.2 方法区 4.3 堆 ​编辑 4.4 虚拟机栈 4.5 程序计数器 4.6 本地方法栈 4.7 解释器和JIT即时编译器 4.9 GC垃圾回收 5.拓展 5.1一些可能会遇到的问…

opencv安装(C++)并配置vs

准备工作&#xff1a; 1.opencv安装包(此教程使用4.9) 2.visual studio(此教程使用vs2019) opencv安装&#xff1a; 1、下载opencv&#xff1a; 1.1 官网下载&#xff1a;Releases - OpenCV 1.2 百度网盘&#xff1a;链接&#xff1a;https://pan.baidu.com/s/1NpEoFjbbyQJtFD…

CTF-希尔加解密

对于希尔加解密很多writeup都说用在线工具&#xff0c;所以研究了一下&#xff0c;写了一个方便的加解密python代码&#xff0c;根据给定的字母表及私钥字符串&#xff0c;尝试不同纬度不同重叠的加密矩阵输出加解密结果。运行效果如下&#xff1a; 代码文件Hill希尔加解密_fi…

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

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

matlab simulink 工业现场漆包机烘炉模糊PID控制算法

1、内容简介 略 70-可以交流、咨询、答疑 2、内容说明 matlab simulink 工业现场漆包机烘炉模糊PID控制算法 第五章 控制算法仿真与分析 在第二章系统分析结合工业现场漆包机烘炉数学模型详细分析模糊PID控制算法以及解耦控制算法的优缺点、实现原理&#xff0c;为本章算法…