当前位置:首页 > linux教程 > 列表

linux下为php添加iconv模块的方法

发布:smiling 来源: PHP粉丝网  添加日期:2021-07-12 10:40:48 浏览: 评论:0 

这篇文章主要介绍了linux下为php添加iconv模块的方法,需要的朋友可以参考下

./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv

make时提示:

  1. ..................................................... 
  2. ext/iconv/.libs/iconv.o(.text+0x1738): In function `zif_iconv_mime_encode': 
  3. /home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1017: undefined reference to `libiconv_open' 
  4. ext/iconv/.libs/iconv.o(.text+0x1756):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1031: undefined reference to `libiconv_open' 
  5. ext/iconv/.libs/iconv.o(.text+0x1993):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1290: undefined reference to `libiconv_close' 
  6. ext/iconv/.libs/iconv.o(.text+0x19ad):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1293: undefined reference to `libiconv_close' 
  7. ext/iconv/.libs/iconv.o(.text+0x1b01):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1102: undefined reference to `libiconv' 
  8. ext/iconv/.libs/iconv.o(.text+0x1b33):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1134: undefined reference to `libiconv' 
  9. ext/iconv/.libs/iconv.o(.text+0x1b5e):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1150: undefined reference to `libiconv' 
  10. ext/iconv/.libs/iconv.o(.text+0x1e10):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1202: undefined reference to `libiconv' 
  11. ext/iconv/.libs/iconv.o(.text+0x1e3c):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1233: undefined reference to `libiconv' 
  12. ext/iconv/.libs/iconv.o(.text+0x207f):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:1277: more undefined references to `libiconv' follow 
  13. ext/iconv/.libs/iconv.o(.text+0x2c08): In function `php_iconv_stream_filter_dtor': 
  14. /home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2393: undefined reference to `libiconv_close' 
  15. ext/iconv/.libs/iconv.o(.text+0x2cf2): In function `php_iconv_stream_filter_append_bucket': 
  16. /home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2543: undefined reference to `libiconv' 
  17. ext/iconv/.libs/iconv.o(.text+0x2d34):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2543: undefined reference to `libiconv' 
  18. ext/iconv/.libs/iconv.o(.text+0x2de7):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2465: undefined reference to `libiconv' 
  19. ext/iconv/.libs/iconv.o(.text+0x30e2): In function `php_iconv_stream_filter_factory_create': 
  20. /home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2419: undefined reference to `libiconv_open' 
  21. collect2: ld returned 1 exit status 
  22. make: *** [sapi/cli/php] Error 1 

解决方法:

  1. wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz 
  2. tar -zxvf libiconv-1.13.1.tar.gz 
  3. cd libiconv-1.13.1 
  4. ./configure --prefix=/usr/local/libiconv 
  5. make 
  6. make install 

再检查php:

  1. #./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv=/usr/local/libiconv 
  2. #make 
  3. #make install 

另一种解决方法为去除iconv模块也能正常编译php,如下:

編輯 Makefile 大約 77 行左右的地方:

EXTRA_LIBS = ..... -lcrypt

在最後加上 -liconv,例如:

EXTRA_LIBS = ..... -lcrypt -liconv

再运行make就可以了。

Tags: php添加iconv模块

分享到: