Apr 30

gd库没支持jpg的处理 不指定

hqlulu , 04:27 , 技术分享 » linux , 评论(0) , 引用(0) , 阅读(387) , Via 本站原创 | |
最近搬服务器,麻烦的就是服务器环境不一样,如题。

其实之前处理过,顺便写出笔记,以后可以重蹈覆辙 ^_^

一般打出phpinfo检查php支持的内容,而正常的gd栏目,应该有:
JPG Support  enabled  

如果没有列出来,那就是缺了jpg的类库,编译没有成功或者忽略了。

检查一下configure的选项说明:

引用
 --with-gd[=DIR]         Include GD support where DIR is GD install prefix.
                         If DIR is not set, the bundled GD library will be used
 --with-jpeg-dir[=DIR]     GD: Set the path to libjpeg install prefix
 --with-png-dir[=DIR]      GD: Set the path to libpng install prefix


需要指定libjpeg的目录,比如:

引用
'--with-gd' \
'--with-png-dir=/usr/local/' \
'--with-jpeg-dir=/usr/local/' \
'--with-freetype-dir=/usr/local/' \


以上是从 config.nice 摘抄的,显然配置的时候添加了命令,支持编译的时候失败了,所以可以补上就可以。

安装包可以网上查找 jpegsrc.v6b.tar.gz
或者有这个方式:
wget http://freshmeat.net/redir/libjpeg/5665/url_tgz/jpegsrc.v6b.tar.gz

解压后在该目录:
./configure --enable-shared --enable-static --prefix=/usr/local &&make &&make install

这样算是完成了jpeg类库的安装吧,然后升级一下php就可以,运行 config.nice ~ 这样可以保持原先的配置,不用自己重新写配置的

编译前,清理一下环境也是必要的:

make clean
make distclean

这样重启apache就可以看到gd栏目有支持了。
Tags: ,
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]