配置Zabbix3.4web端,出现的错误,汇总

版权声明: https://blog.csdn.net/shaopeng1942/article/details/81736125
  • 错误1
类似出现:PHP option "post_max_size"    8M    16M    Fail 等
需要更改php.ini文件,但是在安装PHP时需要指定php的配置文件的存放位置,如我的指定为: --with-config-file-path=/usr/local/php/etc 
然后将源码里面的php.ini-production 拷贝到/usr/local/php/etc/php.ini

注意:在编译安装完成php后,配置完成启动php-fpm时,直接执行/usr/local/php/sbin/php-fpm 虽然可
以启动,但是这样的话,php.ini文件是没有生效的,这就会导致即使你更改了php.ini里面的参数,Zabbix前端检测依然无法通过。解决方法是按照以下方式启动php-fpm:
# /usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini
  • 错误2
PHP bcmath    off        Fail                --enable-bcmath    
PHP mbstring    off        Fail            --enable-mbstring
PHP sockets    off        Fail                --enable-sockets等

这些错误只要在安装PHP时加上对应选项即可,如:--enable-bcmath
  • 错误3
PHP databases support    off        Fail    --with-mysql=/usr/local/mysql    

解决方案:
  这种错误是提示不支持MySQL,但是我们在编译安装时是指定了的,为何出错了?因为更新后的PHP版本,现在需要mysqli的支持才能行,mysqli是对mysql函数(注意这里指的是PHP中的函数)的优化,因此我们需要安装进入PHP源码中的mysqli目录下就可安装,方法如下:
# cd php-5.6.25/ext/mysqli/
# phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config
# make && make install
# cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226
# ls
如果有mysqli.so文件,就说名安装好了。    
接着编辑php配置文件 /usr/local/php/etc/php.ini,加入extension=mysqli.so(可以写全路径)

在make && make install时出现:
/root/soft/php-5.6.25/ext/mysqli/mysqli_api.c:36:47: error: ext/mysqlnd/mysql_float_to_double.h: No such file or directory
make: *** [mysqli_api.lo] Error 1

解决方法:编辑mysqli_api.c,然后注释掉mysql_float_to_double.h这个头文件(讲真,我不知道这样做会有什么后果)
  • 系列错误4
PHP gd JPEG support    off        Fail        --with-jpeg-dir=DIR     GD: Set the path to libjpeg install prefix    
解决方案:编译安装jpeg
# wget http://www.ijg.org/files/jpegsrc.v9b.tar.gz
# mkdir /usr/local/jpeg
# ./configure --prefix=/usr/local/jpeg --enable-shared

PHP gd PNG support    off        Fail        --with-png-dir=DIR      GD: Set the path to libpng install prefix
解决方案:编译安装libpng
# wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.24.tar.gz?download
# mkdir /usr/local/libpng
# ./configure --prefix=/usr/local/libpng

要编译 GD 库,需要libpng 和 libjpeg(前面已经安装了)
PHP gd    unknown    2.0    Fail                --with-gd=DIR           Include GD support.  DIR is the GD library base install directory BUNDLED

解决方案:进入PHP源码的ext/gd目录下编译安装GD库
# yum install gd-devel
# cd php-5.6.8/ext/gd
# phpize
# ./configure --with-jpeg-dir=/usr/local/jpeg --with-php-config=/usr/local/php/bin/php-config 
  提示:configure: error: png.h not found.
  解决:# yum install libpng-devel
       # make clean
       # make install


PHP gd FreeType support    off        Fail    --with-freetype-dir=DIR GD: Set the path to FreeType 2 install prefix
解决方案:编译安装FreeType 
# wget https://sourceforge.net/projects/freetype/files/freetype2/2.6.5/freetype-2.6.5.tar.gz/download
# mkdir /usr/local/freetype
# ./configure --prefix=/usr/local/freetype/
# make && make install

PHP gettext    off        Warning                --with-gettext=DIR      Include GNU gettext support
解决方案:
# wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.tar.gz
# mkdir /usr/local/gettext
# ./configure --prefix=/usr/local/gettext

因此为了支持Zabbix前端,编译安装PHP时需要以下选项:

--prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \
--enable-fastcgi \
--enable-fpm \
--with-config-file-path=/usr/local/php/etc \
-with-zlib=/usr/local/zlib \
--enable-bcmath \ 
--enable-mbstring \
--enable-sockets \
--with-gettext=/usr/local/gettext \
--with-jpeg-dir=/usr/local/jpeg \
--with-png-dir=/usr/local/libpng \
--with-freetype-dir=/usr/include/freetype2/freetype \
--with-gd
--with-mysqli

猜你喜欢

转载自blog.csdn.net/shaopeng1942/article/details/81736125