返回列表 发帖

关于php-5.2.6配置gd的问题

关于php-5.2.6配置gd的问题 -----作者:python中国(www.okpython.com)--老老仙
freetype,jpg,libpng,zlib
php配置如下:
  1. ./configure --prefix=/usr/local/webserver/php --with-gd=/usr/local/gd --with-mysql=/usr/local/webserver/mysql --with-iconv-dir=/usr/local/webserver/lib/libiconv/ --with-freetype-dir=/usr/local/webserver/freetype/ --with-jpeg-dir=/usr/local/webserver/jpg/ --with-png-dir=/usr/local/webserver/libpng --with-zlib --with-libxml-dir=/usr/local/webserver/libxml/ --enable-xml --disable-debug --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-config-file-path=/usr/local/webserver/php/etc
复制代码
配置gd:
  1. ./congure --prefix=/usr/local/gd --with-png=/usr/local/libpng --with-freetype --with-jpg --with-zlib
  2. make&&make install
复制代码
首先make就出现了一个错误:
提示找不到png.h,
搜索了下,解决办法如下:
  1. cp /usr/local/libpng/include/* /root/soft/gd-*
复制代码
然后继续make
make install
成功安装gd
进入php源安装目录:
  1. cd ext/gd
  2. /usr/local/php/bin/phpize
  3. ./configure --with-php-config=/usr/local/php/bin/php-config --with-gd=/usr/local/gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-zlib-dir=/usr
复制代码
make&&make install
一切正常,最后启动PHP。
晕倒,居然提示不能加载gd.so ……
  1. PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/gd.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
复制代码
gd.so已经生成在/usr/local/php/lib/php/*里面了呀
最后经过多次编译调试,终于找到问题所在了,原因是我php.ini里面写了句:
extension="gd.so"
rm php.ini之后
把php源目录下的php.ini-dist复制到/usr/local/php/etc/php.ini
最后启动PHP,一切正常。
让中国Python发展的更快 ,更好.

返回列表