Call to Undefined Function idn_to_ascii()

PHP

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, https://anto.online, again. Also, follow me on Twitter at https://twitter.com/OnlineAnto, to see my latest posts. Feel free to ask any questions if you have any.

About Anto

Hi, my name is Anto! I am a cloud computing hobbyist! Give me anything to do with the cloud, and I am interested. I work for a Cloud computing company by day and as a Cloud computing hobbyist by night! My projects use PHP, NodeJs, Ubuntu, MySQL and of course Amazon Web Services. Hopefully, my blog aids your cloud journey! Feel free to post a comment and share your thoughts.

View all posts by Anto →

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

Leave a Reply

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