You are here: iconv trouble on OS X « PHP « IT news, forums, messages
iconv trouble on OS X

Posted by Marcus Bointon on 07/21/05 19:41

I wrote this question then found out where the problem was, so this
is just for the archives...

==============

I've compiled PHP 5.0.4 successfully on OS X 10.4.2, but I'm getting
a weird problem with iconv. I specified it in my configure line:

--with-iconv

and it seems to pick it up ok while configuring:

checking for iconv support... yes
checking for libiconv in -liconv... yes
checking if iconv is Konstantin Chuguev's... no
checking if iconv supports errno... yes

It builds OK too. php thinks that the iconv extension is there:

> php -m|grep iconv
iconv

The entry in phpinfo() is rather suspicious:

iconv support => enabled
iconv implementation => unknown
iconv library version => unknown

Then in one script I get:

Fatal error: Call to undefined function iconv()

and function_exists('iconv') returns false.

I've also tried specifying --with-iconv=/sw (i.e. using
libiconv-1.9.2-11 from fink), but I get the same results.

================

The solution lies in the user notes for iconv() where someone mentions:

"elk at NOSPAMmodel-fx dot com
26-Jul-2002 04:07
If you use the libiconv library instead of the libc's iconv support,
don't forget to use libiconv() instead of iconv()"

And it really is as simple as that - just substitute libiconv() for
iconv() - it seems that libiconv is the default on OS X. I think this
is a terrible implementation (clearly PHP itself is confused by it, 3
years on from this note) and I've no idea why it was done that way,
but now at least someone can find out easily.

Marcus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация