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 the Authors

Anto's editorial team loves the cloud as much as you! Each member of Anto's editorial team is a Cloud expert in their own right. Anto Online takes great pride in helping fellow Cloud enthusiasts. Let us know if you have an excellent idea for the next topic! Contact Anto Online if you want to contribute.

Support the Cause

Support Anto Online and buy us a coffee. Anything is possible with coffee and code.

Buy me a coffee

About Anto Online

Having started his career in 1999 as a Desktop Support Engineer, Anto soon changed paths and became a developer. After several years of development experience, he transitioned into a consultant. As an enterprise application consultant for a leading SaaS software provider, Anto specializes in AWS's serverless technologies. By day, Anto focuses on helping customers leverage the power of serverless technologies. By night, he indulges his passion for cloud computing by playing with Python and trying out things that are currently beyond the scope of his work. Sometimes Anto needs help as there are not enough hours at night. So Anto relies on a team of fellow Cloud enthusiasts to help him out. Each one is a Cloud expert in their own right, and Anto takes great pride in helping them learn and grow.

View all posts by Anto Online →

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

Leave a Reply

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