zabbix准备:php安装

摘要:
1、 安装php依赖库ftp://xmlsoft.org/libxml2/libxml2-2.9.3.tar.gzyuminstallpython-devel-ycd/download/wget-cftp://xmlsoft.org/libxml2/libxml2-2.9.3.tar.gztarxflibxml2-2.9.3.tar.gz Ctmp/cdtmp/libxml2-2.9.3/./con

一.安装php依赖库

ftp://xmlsoft.org/libxml2/libxml2-2.9.3.tar.gz
yum install python-devel -y
cd /download/
wget -c ftp://xmlsoft.org/libxml2/libxml2-2.9.3.tar.gz
tar xf libxml2-2.9.3.tar.gz -C tmp/
cd tmp/libxml2-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.v9a.tar.gz
tar xf jpegsrc.v9a.tar.gz -C tmp/
cd tmp/jpeg-9a/
./configure --prefix=/usr/local/services/
make && make install

  

ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/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.bz2 -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/re2c/releases/download/0.16/re2c-0.16.tar.gz
http://download.chinaunix.net/down.php?id=45065&ResourceID=5804&site=1
tar xf re2c-0.16.tar.gz -C tmp/
cd tmp/re2c-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

  

  

  

免责声明:文章转载自《zabbix准备:php安装》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇LaTex支持中文的三种方式(首推第一种)Windows如何设置或更改PostgreSQL数据目录位置下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

linux下搭建lamp环境以及安装swoole扩展

一、CentOS 6.5/CentOS 6.9使用yum快速搭建LAMP环境 准备工作:先更新一下yum源  我安装的环境是:apache2.2.15+mysql5.5.60+php5.6.36 输入下面命令: yum -y update 1、安装Apache [root@localhost ~]# yum -y install httpd # 开机自启动...

mysql基本认识【关系型数据库和nosql、mysql操作流程和体系,库操作,表操作,数据的操作,字符集的操作,以及php作为client操作数据库】对连接本身没有疑问

1.关系型数据库永久性保存数据的仓库php的变量只是php脚本执行期间,临时性保存变量的空间【使用内存空间临时保存】 关系型数据库:利用二者的关系来描述实体的信息。【利用二维表字段名和字段值来进行描述】【关系型数据库根本不是可以使用外键将两个表构建成关联的意思,而是实现描述实体的二维表的形式】 nosql:not only sql【sql表示操作关系型数据...

php -- 对象遍历

对象遍历:foreach,遍历对象的公有属性(将公有属性的值和属性名赋值给对应$value和$key) 遍历某一个属性的数组,实现Iterator接口 接口iterator:类实现Iterator接口 current:获取当前数组元素的值$this->hobby[$this->position] key:获取当前下标 next:数组指针下移 r...

安装pod网络插件,执行yum命令时报错:Unable to connect to the server: dial tcp: lookup raw.githubusercontent.com

在安装pod网络插件时报错,错误截图:  产生原因: yum源在国外 解决办法:     浏览器中输入:https://site.ip138.com/raw.Githubusercontent.com/      修改host        修改完hosts,重启网络service network restart...

Zabbix监控USG6300防火墙及交换机

1、登录防火墙直接在web上面配置SNMP,只读团体名、读写团体名、Trap接收主机、安全名,点击应用完成防火墙上面的SNMP配置,如果你的命令行敲得6,可以使用命令行敲,配置效果一样,交换机没有这么优美的图形界面,所以交换机敲的是命令行,人比较懒,就直接在防火墙上面填空了 2、在zabbix部署机上安装net-snmp、net-snmp-utils包,...

现代 PHP 新特性系列(四) —— 生成器的创建和使用

1、概述      生成器是 PHP 5.5 引入的新特性,但是目测很少人用到它,其实这是个非常有用的功能。      生成器和迭代器有点类似,但是与标准的PHP迭代器不同,PHP生成器不要求类实现Iterator接口,从而减轻了类的开销和负担。生成器会根据需求每次计算并产出需要迭代的值,这对应用的性能有很大的影响:试想假如标准的PHP迭代器经常在内存中执...