红帽9中nginx-源码编译php

什么是PHP-FPM? PHP-FPM(FastCGI Process Manager: FastCGI进程管理器)是一个实现了Fastcgi的程序,并且提供进程管理的功能。 进程包括master进程和worker进程。master进程只有一个,负责监听端口,接受来自web server 的请求 worker进程一般会有多个,每个进程中会嵌入一个PHP解析器,进行PHP代码的处理。

1.先源码编译nginx,root底下存在最新版模块

2.进入nginx-1.26.1的目录,执行编译安装

复制代码
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx  --with-http_ssl_module --with-http_v2_module --with-http_realip_module  --with-http_gzip_static_module  --with-http_stub_status_module  --with-pcre --with-stream  --with-stream_ssl_module

3.安装文件

4.检测参数nginx安装是否成功

5.对php源码编译,对软件包进行解压

root@nginx-node1 \~# tar zxf php-8.3.9.tar.gz

4.利用yum解决php依赖

root@Nginx \~# yum install -y bzip2 systemd-devel libxml2-devel sqlite-devel libpng-devel libcurl-devel oniguruma-devel

但是缺失软件包

寻找软件包命令

复制代码
[root@nginx-node1 ~]# yum search oniguruma
[root@nginx-node1 ~]# yum whatprovides */oniguruma*

如果代码搜索不到可以使用---阿里云开源软件镜像站进行搜索

5.进入php目录,对php进行源码安装

复制代码
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-xml --enable-ftp --enable-gd  --enable-exif  --enable-mbstring --enable-bcmath --with-fpm-systemd

检测发现还缺失libsystemd包

安装libcurl-devel-7.76.1-19.el9.x86_64软件包

root@localhost php-8.3.9# yum install libcurl-devel-7.76.1-19.el9.x86_64 -y

使用源码再次安装,检测发现还缺失sqlite3包

复制代码
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-xml --enable-ftp --enable-gd  --enable-exif  --enable-mbstring --enable-bcmath --with-fpm-systemd

安装 sqlite-devel.x86_64软件包

root@localhost php-8.3.9# yum install sqlite-devel.x86_64 -y

使用源码再次安装,检测发现还缺失libpng包

复制代码
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-xml --enable-ftp --enable-gd  --enable-exif  --enable-mbstring --enable-bcmath --with-fpm-systemd

安装libpng-devel.x86_64软件包

root@localhost php-8.3.9# yum install libpng-devel.x86_64 -y

使用源码再次安装,检测发现还缺失oniguruma包

复制代码
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-xml --enable-ftp --enable-gd  --enable-exif  --enable-mbstring --enable-bcmath --with-fpm-systemd

在阿里云开源软件镜像站获取软件包的下载地址

使用yum进行安装

root@localhost \~# yum install oniguruma-devel-6.9.6-1.el9.5.x86_64.rpm

再次使用源码进行编译

复制代码
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-xml --enable-ftp --enable-gd  --enable-exif  --enable-mbstring --enable-bcmath --with-fpm-systemd

源码编译安装成功后,安装软件

root@localhost php-8.3.9# make && make install

相关推荐
东东最爱敲键盘29 分钟前
二阶段总结
运维
Benszen32 分钟前
云计算基础-13:Linux网络管理实战-1
linux·运维·云计算
扬帆破浪44 分钟前
文档自动检查:用 Claude Code、OpenClaw 审 WPS 文件:预览、批注、改正文
运维·服务器·wps
zt1985q1 小时前
本地部署开源网络书签与内容管理工具 Karakeep 并实现外部访问
运维·服务器·网络·数据库·网络协议·开源
具身智能进化论2 小时前
协作机器人产业进入规模化部署期,未来几年的增长从何而来
大数据·运维·人工智能·机器人·自动化·工厂方法模式
夏雪coding3 小时前
nginx SPA 回落把 CSS 变成了 HTML:一个返回 200 却让样式失效的坑
前端·nginx
yunyi3 小时前
改个 SSH 端口,我把自己锁在了服务器外面
运维·后端
渣渣盟3 小时前
当 Redis 写入成为性能瓶颈时,如何利用 异步批量 Sink 将吞吐量从 1w QPS 提升到 10w+?
数据库·redis·php
難釋懷5 小时前
Nginx日志
前端·网络·nginx
九硕智慧建筑一体化厂家5 小时前
从电费支出到碳资产收益,直流照明如何让商业楼宇实现柔性用能
运维·人工智能·智慧城市