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 internationalization 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 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 your 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!

You may also be interested in

About Anto Online

Anto, a seasoned technologist with over two decades of experience, has traversed the tech landscape from Desktop Support Engineer to enterprise application consultant, specializing in AWS serverless technologies. He guides clients in leveraging serverless solutions while passionately exploring cutting-edge cloud concepts beyond his daily work. Anto's dedication to continuous learning, experimentation, and collaboration makes him a true inspiration, igniting others' interest in the transformative power of cloud computing.

View all posts by Anto Online

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

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.