搭建zabbix的时候遇到有对PHP的需求检测,发现没有对gd的支持,记录下。。。
GD库是php处理图形的扩展库,它提供了一系列用来处理图片的API,使用GD库可以处理图片,或者生成图片,也可以给图片加水印。
1、安装zlib,一般系统自带已经安装好,可以用以下命令去查看:
rpm -qa | grep zlib
2、安装libpng
cd /tmp
wget "https://jaist.dl.sourceforge.net/project/libpng/libpng16/1.6.32/libpng-1.6.32.tar.xz"
xz -d libpng-1.6.32.tar.xz
tar xf libpng-1.6.32.tar
cd libpng-1.6.32
./configure
make
make install
安装目录是:/usr/local/include
3、安装freetype
cd /tmp
wget "https://jaist.dl.sourceforge.net/project/freetype/freetype2/2.8.1/freetype-2.8.1.tar.bz2"
tar -jxvf freetype-2.8.1.tar.bz2
cd freetype-2.8.1
./configure
make
make install
安装目录是:/usr/local/include
4、安装jpeg
cd /tmp
wget "http://jpegclub.org/support/files/jpegsrc.v6b2.tar.gz"
tar zxf jpegsrc.v6b2.tar.gz
cd jpeg-6b2/
./configure --enable-shared
make
make test
make install
安装目录是:usr/local/include
5、安装GD
cd /tmp
https://bitbucket.org/libgd/gd-libgd/downloads/ (官网)
tar xf libgd-2.1.1.tar
cd libgd-2.1.1/
./configure --with-png --with-freetype --with-jpeg
make
make install
安装目录是:usr/local/include
6、安装PH
cd /tmp
wget http://cn2.php.net/distributions/php-5.6.0.tar.xz
xz -d php-5.6.0.tar.xz
tar xf php-5.6.0.tar
cd php-5.6.0/
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-sockets --enable-bcmath --enable-mbstring --with-gd --with-zlib --with-png-dir=/usr/local/include/libpng16/ --with-jpeg-dir=/usr/local/include --with-freetype-dir=/usr/local/include/freetype2/freetype
make
make install
cp /tmp/php-5.6.0/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cp /tmp/php-5.6.0/php.ini-development /usr/local/webserver/php/etc/php.ini
cd /usr/local/webserver/php/etc && cp php-fpm.conf.default php-fpm.conf
vim /usr/local/webserver/php-5.6/etc/php.ini
date.timezone = Asia/Shanghai
vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/webserver/php-5.6/bin
source ~/.bash_profile
/etc/init.d/php-fpm start
本文出自 “10620401” 博客,请务必保留此出处http://10630401.blog.51cto.com/10620401/1976886
原文地址:http://10630401.blog.51cto.com/10620401/1976886