linux企业级运维----->PHP配置,nginx结合php-fpm,memcache模块,openresty模块以及高速缓存

本文介绍了在Linux环境中,如何通过源码编译安装PHP,配置php-fpm,结合nginx实现PHP运行,并添加memcache模块以增强缓存能力。接着,通过memc-nginx和srcache-nginx模块构建了高效的透明缓存机制,最后利用openresty优化了nginx的高速缓存,提升了系统性能。
摘要由CSDN通过智能技术生成

一、PHP源码编译

1、安装php

实验环境:已经安装nginx的虚拟机(安装nginx可跳转到我的另一篇博客nginx源码编译)


php下载地址:链接:https://pan.baidu.com/s/15TnjOVKv1RNISIgJpFOOcA 
提取码:on3t 


oniguruma-devel-6.8.2-1.el7.x86_64.rpm 
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
oniguruma-6.8.2-1.el7.x86_64.rpm
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/oniguruma-6.8.2-1.el7.x86_64.rpm
tar  jxf php-7.4.12.tar.bz2 
cd php-7.4.12/
./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --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-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring  --enable-bcmath --with-fpm-systemd  #报错显示缺少安装包
yum install libxml2-devel.x86_64 y#安装缺少的包后重新配置
yum install sqlite-devel.x86_64 -y
yum install libcurl-devel.x86_64  -y
yum install -y systemd-devel -y
yum install libpng-devel.x86_64 -y
wget http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
wget http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/oniguruma-6.8.2-1.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/systemd-libs-219-78.el7.x86_64.rpm
yum install oniguruma-6.8.2-1.el7.x86_64.rpm -y
yum install oniguruma-devel-6.8.2-1.el7.x86_64.rpm -y
./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --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-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring  --enable-bcmath --with-fpm-systemd
#重新编译成功

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述php安装完成
在这里插入图片描述

make#编译
make install#安装

make成功
在这里插入图片描述make install成功
在这里插入图片描述

2、修改php-fpm配置文件

cd /usr/local/lnmp/php/etc/#进入php的安装路径
ls--->php-fpm.conf.default  php-fpm.d
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf
---------------------------
 13 [global]
 14 ; Pid file
 15 ; Note: the default prefix is /usr/local/lnmp/php/var
 16 ; Default Value: none
 17 pid = run/php-fpm.pid#取消注释
---------------------------

在这里插入图片描述
在这里插入图片描述

cp php.ini-production /usr/local/lnmp/php/etc/php.ini
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/
cp sapi/fpm/php-fpm.conf /usr/local/lnmp/php/etc/
cp: overwrite ‘/usr/local/lnmp/php/etc/php-fpm.conf’? y
cp sapi/fpm/www.conf /usr/local/lnmp/php/etc/php-fpm.d/

在这里插入图片描述

[root@server1 php-7.4.12]# cd /usr/local/lnmp/php/etc/
[root@server1 etc]# ls
php-fpm.conf  php-fpm.conf.default  php-fpm.d  php.ini
[root@server1 etc]# vim php.ini #设置时区为亚洲上海

在这里插入图片描述

在这里插入图片描述

cd
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值