How to add the iconv module to php in linux

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.