At present, my operating system is Windows 64-bit. However, I’m unable to initiate a virtual host due to encountering the subsequent error message:
Fatal error: Call to undefined function idn_to_ascii() in C:\wamp64\www\add_vhost.php on line 347
When attempting to launch a virtual host, I observe the following lines appearing on my PHP error log.
[15-May-2019 16:22:56 UTC] PHP Fatal error: Call to undefined function idn_to_ascii() in C:\wamp64\www\add_vhost.php on line 347
[15-May-2019 16:22:56 UTC] PHP Stack trace:
[15-May-2019 16:22:56 UTC] PHP 1. {main}() C:\wamp64\www\add_vhost.php:0
I have attempted to resolve the issue by reinstalling WampServer, and I plan to test copying the complete folder from a colleague to see if that resolves the problem. Is there a possible solution that doesn’t require the involvement of my coworkers?
This is the method I am using to establish my virtual host. Though my colleagues use a similar approach, I am the only one experiencing the error:
The following is the error message that I am receiving:
1 Answer
Introduction
WampServer is a popular web development environment for Windows that allows developers to create and test web applications locally. However, sometimes errors may occur, such as the “Call to undefined function idn_to_ascii()” error when launching a virtual host. This error is caused by a missing PHP extension, and can be resolved by following a few simple steps. In this blog post, we will discuss how to resolve this error on WampServer.
What is idn_to_ascii() function?
The idn_to_ascii() function is a PHP function that converts a domain name to its ASCII representation. This function is useful when working with internationalized domain names (IDNs), which are domain names that contain non-ASCII characters. The idn_to_ascii() function is part of the Internationalization extension (intl) in PHP, which provides functions for handling internationalization (i18n) and localization (l10n) tasks.
Why is the idn_to_ascii() function missing?
The idn_to_ascii() function is not included in the default installation of PHP on WampServer. This is because the Internationalization extension (intl) is not enabled by default. To use the idn_to_ascii() function, the Intl extension needs to be enabled.
Enabling the Intl extension
To enable the Intl extension on WampServer, follow these steps:
Step 1: Stop WampServer
Before making any changes, stop WampServer by clicking on the WampServer icon in the system tray and selecting “Stop All Services”.
Step 2: Enable the extension
Open the PHP extensions menu by clicking on the WampServer icon in the system tray, selecting “PHP”, and then “PHP extensions”. Scroll down to the “intl” extension and click on it to enable it.
Step 3: Restart WampServer
After enabling the Intl extension, restart WampServer by clicking on the WampServer icon in the system tray and selecting “Restart All Services”.
Step 4: Test the idn_to_ascii() function
To test if the idn_to_ascii() function is now working, open a PHP file that contains the function and run it. If the function is working, it should return the ASCII representation of the domain name. If there are still issues, restart your computer and try again.
Conclusion
The “Call to undefined function idn_to_ascii()” error can be frustrating when working with WampServer, but it can be resolved by enabling the Intl extension. By following the steps outlined in this blog post, you can enable the extension and start using the idn_to_ascii() function in your web applications.