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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to