在安装zabbix等软件时会碰到 PHP 缺少 gettext 模块的错误,让你不得不去增加安装一个PHP的gettext模块。
安装php的模块有两种方式:
一、重新编译php,加上--with-gettext
[root@sahedev140 php-5.6.13]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --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-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-mcrypt=/usr/local/libmcrypt --with-gettext
[root@sahedev140 php-5.6.13]# make -j 6;make install;cd
[root@sahedev140 php-5.6.13]# /etc/init.d/php-fpm restart
二、动态安装
找到同版本的php原包,解压后进入ext目录,目录下便是模块列表,进入 gettext 模块。
[root@sahedev140 php-5.6.13]# cd ext/gettext
[root@sahedev140 php-5.6.13]# /usr/local/php/bin/phpize
[root@sahedev140 php-5.6.13]# ./configure –with-php-config=/usr/local/php/bin/php-config
[root@sahedev140 php-5.6.13]# make -j 6 && make install
在php.ini里添加上gettext.so
[root@sahedev140 php-5.6.13]# vim /usr/local/php/php.ini
extension = "gettext.so"
[root@sahedev140 php-5.6.13]# /etc/init.d/php-fpm restart