This is the PHP(4) API for the GNU LibIDN software made by Simon Josefsson. It's intention is to have international characters in the DNS system. See more about the library at Josefsson LibIDN page.

To checkout the code, execute the following two lines after each other. As of version 0.7 (which will be released later today Jan 12, 2004), PHP-IDN can be made externaly from the PHP sources. Just check it out (or unpack the distribution tarball, see below) in a directory of your choice.

        cvs -d login
        cvs -d co idn
Just press the ENTER key when asked for a password. To view the CVS repository through the web browser, turn it to the CVS repository for the IDN PHP API.

To update your CVS directory, execute the following command from within the code directory:

	cvs -d update -P -r REL_1_2b
Please note that the CVS version can break at any time!. The latest version is currently 1.2b, and is availible as a tar ball or as a BZip'ed tar ball and the CVS tag is REL_1_2b.
As of version 1.2, there's both a PHP4 Debian/GNU Linux package as well as a package for PHP5.

When the PHP-IDN module code is checked out, you will have to phpize the source directory. This is done by executing the command

inside the PHP-IDN code directory.
After that's done, you will have to configure the code by executing the command
After this is done, it's time to build the module by executing the command

There's a PHP-IDN mailinglist, and a CVS mailinglist (which show each commit to the CVS). Documentation on the API is currently in progress, but it's more or less complete. There's also a bug tracking system, so if you find a bug, plese go to the bug tracker and submit one.
Have a look at the Demo IDNA converter if you want to have a go at converting your internationalized domain names.

Update 20061124:

  • Release of 1.2b
  • Missed part of the GCC 4.1 compiler warnings patch.
  • Update 20061121:

  • Release of 1.2
  • Don't throw critical error if php-idn can't convert from one string to another.
  • Update 20060105:

  • Fixed GCC 4.1 compiler warnings. Thanx to Robert Scheck. This fix only in HEAD though!
  • Update 20041218:

  • Support building on PHP5 using the ZEND_ENGINE_2 define (if defined => PHP5).
  • This because OnUpdateInt was removed in favor of OnUpdateLong.
  • Missing PHP parser code added in idn.php.
  • Some slight updates to README.documentation on how to build the reference documentation
  • Update 20040426:

  • Support TLD checking (patch by Thomas Jacob)
  • Show version of LibIDN and configuration values when dumping info.
  • Lots of other small bugfixes that mainly solves the memory problem (patches by Thomas Jacob)
  • Cleanup and rewrite of example PHP page
  • Update 20040204: Thanx to Thomas Jacob for sending patches that fixes some more memory management issues still left from 0.8.

    Update 20040130: Thanx to Sascha Kettler for sending patches that fixes PHP threading error(s) and memory leaks. Thease patches are included in the current version - version 0.8.

    Update 20040113: It is now possible to compile the PHP-IDN module separate from the PHP source tree. This is possible using phpize (distibuted and built from the PHP source). Also, since 0.7, there's also a Debian GNU/Linux package. Currently, only the i386 package exists prebuilt, but you can download the source files, and rebuild your own (using dpkg-source and debuild commands).

    Update 20031111: Lost's of bugfixes - mostly memory problems. Don't segfault etc as much, but really works (every time! :). This is version 0.5.

    Update 20031109: The API have been finalized. It's quite different from version 0.2 above, so make sure you don't use that. Here's version 0.4. Look at the included test script in 'tests/idn.php' on how to use it (the IDNA converter referenced above always use the very latest API).
    The 0.4 version also includes the rudimentary framework for an API reference. The idea is to have PHP-IDN included in PHP, so hoppfully this API reference will be located at the site... To check that the module is loaded, use THIS code (not the one above!)

    if(function_exists("idn_to_ascii")) {
        echo "idn exists";

    Update 20031107: Have been testing and updating the module during the day, now it works almost perfect! I still have some memory leeks. Or if it's the combination of Apache and PHP as described on the following URL's: and I don't know at the moment, but I'll try to find out...
    I have a preliminary tarball for you to test out. See above to get it compiled... Also have a look at MY version of the IDNA converter. If it can't convert the value (you get an error) or you don't get a reply in a timely manner, try reloading the page a couple of times (Apache probably crashed).
    Note that my IDNA converter is very limited because all functionality haven't been tested, but I'm working on it...

    Update 20031106: The module compiled just niceley (after discovering that I had to use options to the --with-idn parameter). Some simple test code verified that the module was loaded and worked.

    if(function_exists("idn_unicode_to_ascii")) {
        echo "idn exists";
    I will now start testing it and see if it does the conversion it's supposed to...

    Update 20031031: Code was written and commited into CVS yesterday. I'm now in the process of testing the module. I don't expect it to work (it was quite a quick hack), but with a little optimization it should work. The basics are there, now I just need to fine tune the code :).