配置PHP对gd库的支持
2017-10-27 18:24
309 查看
搭建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
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
相关文章推荐
- Mac下配置PHP支持GD库FreeType
- (转)php中GD库的配置,解决dedecms安装中GD不支持问题
- Win7下,在IIS7中配置PHP的FastCGI支持_笔记
- xp 中支持php的环境的iis配置
- centos6.5直接yum安装nginx,并且支持php访问的配置
- Apache 配置------FastCGI方式使用PHP(包含:linux下编译安装fmod_fcgid,配置apache以支持FastCGI)
- apach配置php,cgi支持遇到的一些问题解决方法
- 在Apache中支持PHP的配置参数
- php配置GD库
- PHP配置使PHP在页面中支持<?= $content; ?>输出内容
- PHP GD库及jpgraph的安装与配置
- 在IIS6中配置PHP/Perl支持
- php实现的支持imagemagick及GD库两种处理的缩略图生成类
- Nginx目录别名(Alias)支持PHP的配置
- 使IIS支持PHP,ISAPI或CGI,FastCGI完全配置教程(最新php5.2.13配置方法)
- apache中配置php支持模块模式、cgi模式和fastcgi模式
- Win2003下配置iis+php+mysql+zend图文 使其支持asp,.net,cgi,perl和php
- Win7下,在IIS7中配置PHP的FastCGI支持
- apache对php支持的配置
- nginx虚拟机配置(支持php)