Call to Undefined Function idn_to_ascii()


The “Call to Undefined Function idn_to_ascii()” error in PHP can be confusing. Many people assume this function is part of PHP, and it is, but not always!

It turns out that the idn_to_ascii() function is only available in the internationalisation module (or intl module). The int module provides Unicode and Globalization support for PHP. It also provides many functions that are useful for date and time formatting. The idn_to_ascii() function is one of these functions. It is used to convert a Unicode domain name to an IDNA ASCII-compatible format.

Install idn_to_ascii() via Ubuntu

You can install idn_to_ascii() by running the following in your Ubuntu console:

sudo apt-get install php7.2-intl

Note: You may use a different version of PHP, so simply change the version number from 7.2 to yours. Also, you may need to restart Apache and PHP-FPM if needed:

NOTICE: Not enabling PHP 7.2 FPM by default.
NOTICE: To enable PHP 7.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.

Install idn_to_ascii() via CPanel

CPanel allows you to select the version of PHP. You can also choose the various PHP modules you want to enable.

Open you CPanel and look for the ‘Select PHP Version’ menu item.

CPanel – Select PHP version

Next, enable the idn_to_ascii() function by selecting ‘intl’ from the list.

CPanel – Select intl to enable idn_to_ascii()

Remember to click ‘save’! :-)

Your idn_to_ascii() function should now be defined!

Please visit my blog,, again. Also, follow me on Twitter at, to see my latest posts. Feel free to ask any questions if you have any.

3 Comments on “Call to Undefined Function idn_to_ascii()”

Leave a Reply

Your email address will not be published. Required fields are marked *