zabbix准备:php安装
一.安装php依赖库
ftp://xmlsoft.org/libxml 2 /libxml 2 -2.9 . 3 .tar.gz yum install python-devel -y cd /download/ wget -c ftp://xmlsoft.org/libxml 2 /libxml 2 -2.9 . 3 .tar.gz tar xf libxml 2 -2.9 . 3 .tar.gz -C tmp/ cd tmp/libxml 2 -2.9 . 3 / ./configure --prefix=/usr/ local /services/ make && make install |
https://curl.haxx.se/download/curl -7.44 . 0 .tar.gz tar xf curl -7.44 . 0 .tar.gz -C tmp/ cd tmp/curl -7.44 . 0 / ./configure --prefix=/usr/ local /services/ make && make install |
http://www.ijg.org/files/jpegsrc.v 9 a.tar.gz tar xf jpegsrc.v 9 a.tar.gz -C tmp/ cd tmp/jpeg -9 a/ ./configure --prefix=/usr/ local /services/ make && make install |
ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng 16 /libpng -1.6 . 28 .tar.gz http://download.sourceforge.net/libpng/libpng -1.6 . 2 .tar.gz tar xf libpng -1.6 . 2 .tar.gz -C tmp/ cd tmp/libpng -1.6 . 2 / ./configure --prefix=/usr/ local /services/ make && make install |
http://download.savannah.gnu.org/releases/freetype/freetype -2.6 . 5 .tar.gz http://download.chinaunix.net/down.php?id= 35028 &ResourceID= 3295 &site= 1 tar xf freetype -2.4 . 3 .tar.bz 2 -C tmp/ cd tmp/freetype -2.4 . 3 / ./configure --prefix=/usr/ local /services/ make && make install |
https://github.com/libevent/libevent/releases/download/release -2.1 . 8 -stable/libevent -2.1 . 8 -stable.tar.gz http://download.chinaunix.net/down.php?id= 45065 &ResourceID= 5804 &site= 1 tar xf libevent -2.0 . 21 -stable.tar.gz -C tmp/ cd tmp/libevent -2.0 . 21 -stable/ ./configure --prefix=/usr/ local /services/ --disable-debug-mode make && make install |
https://github.com/skvadrik/re 2 c/releases/download/ 0.16 /re 2 c -0.16 .tar.gz http://download.chinaunix.net/down.php?id= 45065 &ResourceID= 5804 &site= 1 tar xf re 2 c -0.16 .tar.gz -C tmp/ cd tmp/re 2 c -0.16 / ./configure --prefix=/usr/ local /services/ make && make install |
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt -2.5 . 7 .tar.gz tar xf libmcrypt -2.5 . 7 .tar.gz -C tmp/ cd tmp/libmcrypt -2.5 . 7 / ./configure --prefix=/usr/ local /services/ make && make install |
二.安装php
wget http: //cn2 .php.net /distributions/php-5 .6.31. tar .gz |
. /configure --prefix= /usr/local/php --with-config- file -path= /usr/local/php/etc -- enable -fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv- dir --with-freetype- dir --with-jpeg- dir --with-png- dir --with-zlib --with-libxml- dir = /usr -- enable -xml --disable-rpath -- enable -bcmath -- enable -shmop -- enable -sysvsem -- enable -inline-optimization --with-curl -- enable -mbregex -- enable -mbstring --with-mcrypt -- enable - ftp --with-gd -- enable -gd-native-ttf --with-openssl --with-mhash -- enable -pcntl -- enable -sockets --with-xmlrpc -- enable -zip -- enable -soap --without-pear --with-gettext --with-ldap --disable-fileinfo -- enable -maintainer-zts make && make install |
configure过程中各种糟心,缺少各种xx.h文件或者各种xx未声明,一般都是缺少开发库
yum install libxml2-devel -y yum install libcurl-devel -y yum install libjpeg-devel -y yum install libpng-devel -y yum install freetype-devel -y yum install libmcrypt* -y libmcrypt明明已经安装但缺少devel包,centos自带yum和163yum都没有对应包(libmcrypt-devel)下载,epel可以很好的解决这一难题,参考链接: http: //www .cnblogs.com /SunnyZhu/p/5420549 .html http: //www .linuxidc.com /Linux/2015-08/121079 .htm yum install epel-release -y #除了rpm安装,也可yum安装epel yum install libmctypt-devel -y yum install openldap openldap-devel -y cp -frp /usr/lib64/libldap * /usr/lib/ |
三.修改php-fpm配置文件
cp /usr/local/php/etc/php-fpm .conf.default /usr/local/php/etc/php-fpm .conf cp /download/tmp/php-5 .6.31 /php .ini-production /usr/local/php/etc/php .ini |
vi php-fpm.conf ;listen = 127.0.0.1:9000 listen = /tmp/php-cgi .sock #以socke的方式访问.注视掉.ip端口的方式. ; Default Value: log /php-fpm .log error_log = /data/php_log/php .error #根据不同的项目名.定义不同的.sock 和日志. # 调整进程数量 pm.max_children:p静态方式下开启的php-fpm进程数量。 pm.start_servers:动态方式下的起始php-fpm进程数量。 pm.min_spare_servers:动态方式下的最小php-fpm进程数量。 pm.max_spare_servers:动态方式下的最大php-fpm进程数量。 |
mkdir /data/php_log |
尝试访问php页面出错,查看错误日志: var /log/nginx/error .log报错: 2017 /08/04 04:55:58 [crit] 61807 #61807: *6 connect() to unix:/tmp/php-cgi.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.119.129, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "192.168.119.130" ll /tmp/php-cgi .sock发现属主属组都为root用户,因此错误原因就是:nginx的deamon用户无权限调用该socket与php-fpm通信 |
修改php-fpm配置文件/usr/local/php/etc/php-fpm.conf
使/tmp/php-cgi.sock属主属组为nginx执行用户
user = deamon group = deamon listen.owner = deamon listen.group = deamon |
修改nginx配置文件/usr/local/nginx/conf/nginx.conf
location ~ \.php$ { root /www ; fastcgi_pass unix: /tmp/php-cgi .sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } |
启动php
#/usr/local/php/sbin/php-fpm |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 推荐几款开源且免费的 .NET MAUI 组件库
· 实操Deepseek接入个人知识库
· 易语言 —— 开山篇
· Trae初体验