This article describes how to add the iconv module for php in linux. For more information, see. /configure -- with-mysql =/backup/mysql -- with-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib -- with-curl --- gd -- enable-gd-native-ttf -- with-apxs2 =/usr/local/apache/bin/apxs -- enable-sockets -- with-iconv
Make prompt:
The code is as follows:
........................................ .............
Ext/iconv/. libs/iconv. o (. text + 0x1738): In function 'zif _ iconv_mime_encode ':
/Home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1017: undefined reference to 'libiconv _ open'
Ext/iconv /. libs/iconv. o (. text + 0x1756):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1031: undefined reference to 'libiconv _ open'
Ext/iconv /. libs/iconv. o (. text + 0x1993):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1290: undefined reference to 'libiconv _ close'
Ext/iconv /. libs/iconv. o (. text + 0x19ad):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1293: undefined reference to 'libiconv _ close'
Ext/iconv /. libs/iconv. o (. text + 0x1b01):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1102: undefined reference to 'libiconv'
Ext/iconv /. libs/iconv. o (. text + 0x1b33):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1134: undefined reference to 'libiconv'
Ext/iconv /. libs/iconv. o (. text + 0x1b5e):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1150: undefined reference to 'libiconv'
Ext/iconv /. libs/iconv. o (. text + 0x1e10):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1202: undefined reference to 'libiconv'
Ext/iconv /. libs/iconv. o (. text + 0x1e3c):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1233: undefined reference to 'libiconv'
Ext/iconv /. libs/iconv. o (. text + 0x207f):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 1277: more undefined references to 'libiconv' follow
Ext/iconv/. libs/iconv. o (. text + 0x2c08): In function 'php _ iconv_stream_filter_dtor ':
/Home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 2393: undefined reference to 'libiconv _ close'
Ext/iconv/. libs/iconv. o (. text + 0x2cf2): In function 'php _ iconv_stream_filter_append_bucket ':
/Home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 2543: undefined reference to 'libiconv'
Ext/iconv /. libs/iconv. o (. text + 0x2d34):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 2543: undefined reference to 'libiconv'
Ext/iconv /. libs/iconv. o (. text + 0x2de7):/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 2465: undefined reference to 'libiconv'
Ext/iconv/. libs/iconv. o (. text + 0x30e2): In function 'php _ iconv_stream_filter_factory_create ':
/Home/jjdai/work/zhupiter/php-5.2.0/ext/iconv. c: 2419: undefined reference to 'libiconv _ open'
Collect2: ld returned 1 exit status
Make: *** [sapi/cli/php] Error 1
Solution
The code is as follows:
Wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
Tar-zxvf libiconv-1.13.1.tar.gz
Cd libiconv-1.13.1
./Configure -- prefix =/usr/local/libiconv
Make
Make install
Check php again
The code is as follows:
#. /Configure -- with-mysql =/backup/mysql -- with-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib -- with-curl --- gd -- enable-gd-native-ttf -- with-apxs2 =/usr/local/apache/bin/apxs -- enable-sockets -- with-iconv =/usr/local/libiconv
# Make
# Make install
Another solution is to remove the iconv module and compile php normally, as shown below:
Too many Makefile is about 77 rows long:
EXTRA_LIBS =...-lcrypt
Add-liconv at the end, for example:
EXTRA_LIBS =...-lcrypt-liconv
Run make again.