您现在的位置:首页 >> PHP >> 内容

php安装gd(freetype、jpeg、png、zlib)

时间:2013-11-30 7:05:12 点击:

  核心提示:安装php需要gd(freetype、jpeg、png)支持 1、安装freetype[root@localhost softs]# tar xf freetype-2.5.0.tar.bz2 -C...
安装php需要gd(freetype、jpeg、png)支持
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 --with-apxs2=/usr/local/apache2/bin/apxs --disable-ipv6 --with-libxml-dir=/usr --with-openssl=/usr --with-zlib=/usr --with-bz2=/usr --with-curl=/usr  --enable-ftp --with-mysql=/usr/local/mysql --with-mysql-sock=/var/run/mysqld/mysql5.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-dir=/usr/local/zlib/ --with-zlib
 
[root@localhost php-5.3.27]# make && make install
 
8、查看php的所有支持模块
 
[root@localhost lib]# php -m
[PHP Modules]
bcmath
bz2
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mbstring
mysql
mysqli
openssl
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
sockets
SPL
SQLite
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

作者:不详 来源:网络
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 青春网络编程技术(www.qcfupo.com) © 2020 版权所有 All Rights Reserved.
  • Powered by qcfupo! V3.0sp1
  • 百度友情链接: 百家乐[www.chinawestnews.net/aomenbaijiale/] 赌博网[www.chinawestnews.net/amdbwz/] 海立方[www.bjl.gov.cn/bjgylc/] 娱乐城[www.gtxrmzf.gov.cn/mapai/] 娱乐城[www.hfsf.gov.cn/yfgj/] 威尼斯人[www.hllinkou.gov.cn/baijile/] 澳门威尼斯[www.jjwgj.gov.cn/wnsr/] 888真人[www.lagm.gov.cn/888zhenren/] 百乐坊[www.laoling.gov.cn/blfylc/] 现金网[www.longyu.gov.cn/xjw/] 百家乐[www.chinawestnews.net/ambjl/] 新葡京娱乐场[www.sjzedu.gov.cn/jsylc/] 时时彩[www.snjw.gov.cn/ssc/] 赌博[www.chinawestnews.net/aomendubo/]