zoukankan      html  css  js  c++  java
  • 二,zabbix与php的一些问题

    zabbix 检查先决条件

    一、php-bcmath 不支持

    php 安装 bcmath 扩展(编译安装)

    PHP的linux版本需要手动安装BCMath扩展,在PHP的源码包中默认包含BCMath的安装文件,
    只需手动安装一次即可。
           编译安装
       1.进入PHP源码包目录下的ext/bcmath目录。
       2.执行phpize命令,phpize命令在PHP安装目录的bin目录下,如/usr/local/php-5.6.36/bin/phpize。

    (phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块
    比如你想在原来编译好的php中加入memcached或者ImageMagick等扩展模块,
    可以使用phpize。)。使用如下:
    tar zxvf memcache-2.2.5.tgz
    cd memcache-2.2.5/ #进入刚解压的模块中使用。
    /usr/local/webserver/php/bin/phpize
    ./configure –with-php-config=/usr/local/webserver/php/bin/php-config
    make
    make install


       3.执行./configure --with-php-config=/usr/local/php/bin/php-config。
       4.执行make && make install。
       5.将安装完成后得到bcmath.so文件拷贝到php.ini中extension_dir配置的目录中。
    开启 extension_dir,后面自己配置扩展模块的目录。
    6.在Dynamic Extensions配置块下添加一行extension=bcmath.so。
       7.重启php服务即可。
    8.使用命令 php -m | grep bcmath ,查看这个模块是否加载成功。

    其实这个模块在编译php的时候可以直接打开 后面加上参数 --enable-bcmath 即可

     

    二、php的参数在php.ini中搜索。


    PHP选项“max_input_time” 按照要求设置
    PHP选项“date.timezone” 设置为 PRC

    PHP选项“always_populate_raw_post_data” 这个报错直接去掉注释即可

    三、解决php的gd库不支持jpeg和freetype的问题。

    1,下载jpeg和freetype的源码包,解压安装,预编译目录在 /usr/local/freetype 和 /usr/local/jpeg
    编译例如 ./configure --prefix=/usr/local/php/jpeg --enable-shared --enable-static
    然后 make && make install

    2,重新编译php,注意先不带gd,不要--with-gd。编译如下:
    ./configure
    --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc
    --enable-fpm --enable-pcntl --enable-mysqlnd --enable-opcache --enable-sockets
    --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-zip
    --enable-ftp --enable-soap --enable-xml --enable-mbstring --enable-bcmath
    --disable-rpath --disable-debug --disable-fileinfo
    --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
    --with-pcre-regex --with-iconv --with-zlib --with-mcrypt --with-openssl
    --with-mhash --with-xmlrpc --with-curl --with-imap-ssl
    --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype

    然后make && make install
    此时PHPinfo()中没有gd库。

    3,接下来在php源码解压后目录下的ext/gd 中执行phpize 后编译安装gd。
    ./configure --with-php-config=/usr/local/php/bin/php-config
    --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype

    make && make install

    启动php-fpm 发现gd库出现了,并且支持jpeg和freetype。
    至此解决这个问题,zabbix服务端可以检测出来。

    四、PHP LADP warnning 解决。php gettext 也是类似解决。

    http://www.cnblogs.com/bigdevilking/p/9440098.html


    # 出现告警是因为ldap模块不存在,须要编译生成此模块并重新加载

    进入PHP源码包目录下的ext/ldap 目录 。
    [root@DaMoWang php-7.2.7]# cd /usr/src/php-7.2.7/ext/ldap/ # 进入模块所在的源码位置
    [root@DaMoWang ldap]# ls
    config.m4 config.w32 CREDITS ldap.c ldap.mak LDAP_Win32_HOWTO.txt php_ldap.h tests
    [root@DaMoWang ldap]# /usr/local/php/bin/phpize # 编译PHP扩展的工具,主要是根据系统信息生成对应的configure文件
    Configuring for:
    PHP Api Version: 20170718
    Zend Module Api No: 20170718
    Zend Extension Api No: 320170718
    [root@DaMoWang ldap]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-ldap
    && make && make install #配置 编译 安装

    执行过程中可能会有如下报错

    configure: error: Cannot find ldap.h
    解决办法 : yum -y install openldap openldap-devel

    configure: error: Cannot find ldap libraries in /usr/lib
    解决办法 : cp -frp /usr/lib64/libldap* /usr/lib/

    [root@DaMoWang ldap]# vim /etc/php.ini # 编辑php.ini
    # 找到 ;extension=ldap 的行 把注销去掉 , 5版本的php添加extension=ldap.so

    五,zabbix最后一步安装报错

    Details Cannot create the configuration file.
    Unable to create the configuration file.
    (细节 无法创建配置文件。无法创建配置文件。)

    解决:设置 web服务器用户在zabbix网页的conf/目录具有写权限,配置文件会自动保存。
    设置目录的 w 权限即可
    chmod 777 conf/

  • 相关阅读:
    断开Oracle连接用户
    【转】Windows英文操作系统下ArcGIS 显示和保存中文数据
    断开Oracle连接用户
    如何判断标准输入或输出是否经过了重定向,即是否在命令行上使用了“”?
    PHP MYSQL网站注入扫描
    在PHPLIB中的MYSQL类中加INSERT,UPDATE,DELETE等函数
    为Linux安置红旗紫光输出法
    Linux下Resin JSP MySQL的摆设和设置配备摆设2
    红旗Linux桌面4.1文本安顿过程图解(一)
    MYSQL数据迁移tips,ORA00907: missing right parenthesis
  • 原文地址:https://www.cnblogs.com/fengfengyang/p/10174054.html
Copyright © 2011-2022 走看看