phpunicodenormalizationphp-5.3unicode-normalization

PHP 5.3 can't find normalizer_normalize()


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?


Solution

  • 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.