安装包位置:http://www.p-pp.cn/app/zabbix/
1、安装freetype
[root@localhost softs]# tar xf freetype-2.5.0.tar.bz2 -C /usr/src/
[root@localhost softs]# cd /usr/src/freetype-2.5.0
[root@localhost freetype-2.5.0]# ./configure --prefix=/usr/local/freetype --enable-shared
[root@localhost freetype-2.5.0]# make && make install
2、安装png
[root@localhost softs]# tar xf libpng-1.6.6.tar.gz -C /usr/src/
[root@localhost softs]# cd /usr/src/libpng-1.6.6/
[root@localhost libpng-1.6.6]# ./configure --prefix=/usr/local/png --enable-shared
[root@localhost libpng-1.6.6]# make && make install
3、安装jpeg
[root@localhost softs]# tar xf jpeg-6b.tar.gz -C /usr/src/
[root@localhost softs]# cd /usr/src/jpeg-9/
[root@localhost jpeg-9]# ./configure --prefix=/usr/local/jpeg --enable-shared
[root@localhost jpeg-9]# make && make install
4、安装zlib
[root@localhost softs]# tar xf zlib-1.2.2.2.tar.gz -C /usr/src/
[root@localhost softs]# cd /usr/src/zlib-1.2.2.2
[root@localhost zlib-1.2.2.2]# ./configure --prefix=/usr/local/zlib
[root@localhost zlib-1.2.2.2]# make && make install
5、安装libgd
[root@localhost softs]# tar xf libgd-2.1.0.tar.xz -C /usr/src/
[root@localhost softs]# cd /usr/src/libgd-2.1.0/
[root@localhost libgd-2.1.0]# ./configure --prefix=/usr/local/gd --enable-shared --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png=/usr/local/png --with-zlib=/usr/local/zlib
编译 gd-2.0.33.tar.gz 时出现了如下错误:
/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' can not be used when
making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libgd.la] 错误 1
make[2]: Leaving directory `/usr/local/src/gd-2.0.33'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/usr/local/src/gd-2.0.33'
make: *** [all] 错误 2
解决办法 : 重新安装 zlib-1.2.3.tar.gz
[root@unix-server1 zlib-1.2.3]#sudo CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib/
Checking for gcc...
Building static library libz.a version 1.2.3 with gcc.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.
[root@unix-server1 zlib-1.2.3]# make
gcc -O3 -fPIC -DUSE_MMAP -c -o example.o example.c
gcc -O3 -fPIC -DUSE_MMAP -c -o adler32.o adler32.c
gcc -O3 -fPIC -DUSE_MMAP -c -o compress.o compress.c
gcc -O3 -fPIC -DUSE_MMAP -c -o crc32.o crc32.c
gcc -O3 -fPIC -DUSE_MMAP -c -o gzio.o gzio.c
gcc -O3 -fPIC -DUSE_MMAP -c -o uncompr.o uncompr.c
gcc -O3 -fPIC -DUSE_MMAP -c -o deflate.o deflate.c
gcc -O3 -fPIC -DUSE_MMAP -c -o trees.o trees.c
gcc -O3 -fPIC -DUSE_MMAP -c -o zutil.o zutil.c
gcc -O3 -fPIC -DUSE_MMAP -c -o inflate.o inflate.c
gcc -O3 -fPIC -DUSE_MMAP -c -o infback.o infback.c
gcc -O3 -fPIC -DUSE_MMAP -c -o inftrees.o inftrees.c
gcc -O3 -fPIC -DUSE_MMAP -c -o inffast.o inffast.c
ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
gcc -O3 -fPIC -DUSE_MMAP -o example example.o -L. libz.a
gcc -O3 -fPIC -DUSE_MMAP -c -o minigzip.o minigzip.c
gcc -O3 -fPIC -DUSE_MMAP -o minigzip minigzip.o -L. libz.a
[root@unix-server1 zlib-1.2.3]# make install
cp zlib.h zconf.h /usr/local/zlib//include
chmod 644 /usr/local/zlib//include/zlib.h /usr/local/zlib//include/zconf.h
cp libz.a /usr/local/zlib//lib
cd /usr/local/zlib//lib; chmod 755 libz.a
cd /usr/local/zlib//lib; if test -f libz.so.1.2.3; then
rm -f libz.so libz.so.1;
ln -s libz.so.1.2.3 libz.so;
ln -s libz.so.1.2.3 libz.so.1;
(ldconfig || true) >/dev/null 2>&1;
fi
cp zlib.3 /usr/local/zlib//share/man/man3
chmod 644 /usr/local/zlib//share/man/man3/zlib.3
[root@unix-server1 zlib-1.2.3]# make clean
rm -f *.o *~ example minigzip
libz.* foo.gz so_locations
_match.s maketree contrib/infback9/*.o
[root@localhost libgd-2.1.0]# ./configure --prefix=/usr/local/gd --enable-shared --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png=/usr/local/png --with-zlib=/usr/local/zlib
[root@localhost libgd-2.1.0]# make && make install
6、重新配置文件
[root@localhost libgd-2.1.0]# echo "/usr/local/mysql/lib" >> /etc/ld.so.conf
[root@localhost libgd-2.1.0]# ldconfig
7、安装 php
[root@localhost softs]# tar xf php-5.3.27.tar.gz -C /usr/src/
[root@localhost softs]# cd /usr/src/php-5.3.27/
[root@localhost php-5.3.27]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --disable-ipv6 --with-libxml-dir= --with-openssl --with-zlib --with-bz2 --with-curl --enable-ftp --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.socket --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-bcmath --enable-mbstring --enable-sockets --with-gd --with-jpeg-dir=/usr/local/jpeg/ --with-png-dir=/usr/local/png/ --with-freetype-dir=/usr/local/freetype --with-zlib
[root@localhost php-5.3.27]# make && make install
8、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