I am trying to use the normalizer_normalize() function introduced in PHP 5.3 (says the doc), however I can't use it:
$ php -r 'echo normalizer_normalize("tést");'
PHP Fatal error: Call to undefined function normalizer_normalize()
in Command line code on line 1
I've checked my PHP version but it's 5.3:
$ php --version
PHP 5.3.6 (cli) (built: Sep 12 2011 18:02:42)
I don't understand why PHP can't find it?
Normalizer is part of the intl extension . While it's built by default , that does not necessarily mean that the specific version of PHP that you are using has it installed or enabled by default.
If you're getting your PHP version from your operating system, check to see if the package manager has a package named php-intl
. If not, check for php-pecl-intl
. If you're using RHEL/CentOS/Scientific Linux 5.x, also look for php53-intl
.
I wanted to give a modern, up-to-date answer, as things seem to have changed a bit since 2012. Using Ubuntu 20.04 and PHP8.1, I was able to get this to work with just...
sudo apt-get install php8.0-intl
Don't forget to do a full apache restart afterwards (either one of these should do it)...
systemctl restart apache2
/etc/init.d/apache2 restart
In addition, this automatically installed the updated 8.1-version...
root@ dpkg --list | grep 'intl'
ii php8.0-intl 1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php8.1-intl 8.1.8-1+ubuntu20.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.