Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Sep 2005 12:22:49 +0300
From:      Toomas Aas <toomas.aas@raad.tartu.ee>
To:        php-general@lists.php.net, questions@freebsd.org
Subject:   iconv() in PHP returns 'Unknown error 0'
Message-ID:  <431EB169.7010602@raad.tartu.ee>

next in thread | raw e-mail | index | archive | help
Hello!

I am managing a FreeBSD 4.11 server which is currently running PHP=20
4.3.11.  The server was originally installed in 2003 with an older=20
version of PHP and libiconv 1.8. All software has been installed from=20
FreeBSD ports. Over the time PHP has been upgraded several times, but=20
libiconv has remained untouched:

mail# pkg_info | grep iconv
libiconv-1.8_2      A character set conversion library
php4-iconv-4.3.11   The iconv shared extension for php

There was a time when PHP's iconv() function definitely worked on this=20
server, but now it seems to have a problem. I copied and pasted this=20
simple test script from www.php.net:

-----------------------------------------------------
<?php
echo iconv("ISO-8859-1", "UTF-8", "This is a test.");
?>
-----------------------------------------------------

When I load this script via the browser, PHP outputs nothing. I have=20
error logging set to file only, and in the log file there is this error:

[07-Sep-2005 12:10:07] PHP Notice:  iconv(): Unknown error (0) in=20
/storage/www/iconvtest.php on line 2

This is the only error I see in PHP's error log or any other logfile=20
with similar timestamp.

The iconv extension is loaded and can be seen in output of phpinfo().

I read that sometimes on FreeBSD you need to use libiconv() instead of=20
iconv(), but this is not the case here - when I replace iconv() with=20
libiconv() I get "PHP Fatal error:  Call to undefined function:=20
libiconv()".

I can successfully run iconv from command line:
$ echo This is a test. > iconvtest
$ iconv -f "ISO-8859-1" -t "UTF-8" iconvtest
This is a test.

Is it possible that my problem is caused by anything *else* than iconv=20
library being out of date compared to PHP's iconv extension? If I need=20
to update libiconv, I also need to update lot of things that depend on=20
it, and this takes some time. If there is some quicker way to get PHP's=20
iconv extension functional, I'd prefer to use that for now.

--=20
Toomas Aas --------------------------------------------------------
|arvutiv=F5rgu peaspetsialist | head specialist on computer networks|
|Tartu Linnakantselei       | Tartu City Office                   |
----------------------------------------------------- +372 736 1274





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?431EB169.7010602>