简体   繁体   English

PHP 5.3 找不到 normalizer_normalize()

[英]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 5.3 中引入的normalizer_normalize() function(文档说),但是我不能使用它:

$ 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 版本,但它是 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?不明白为什么 PHP 找不到?

Normalizer is part of the intl extension . Normalizer是intl扩展的一部分。 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. 虽然它是默认构建 ,但这并不一定意味着您使用的特定版本的PHP默认安装或启用它。

If you're getting your PHP version from your operating system, check to see if the package manager has a package named php-intl . 如果您从操作系统获取PHP版本,请检查包管理器是否有名为php-intl的包。 If not, check for php-pecl-intl . 如果没有,请检查php-pecl-intl If you're using RHEL/CentOS/Scientific Linux 5.x, also look for php53-intl . 如果您使用的是RHEL / CentOS / Scientific Linux 5.x,请查找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...我想给出一个现代的、最新的答案,因为自 2012 年以来情况似乎发生了一些变化。使用 Ubuntu 20.04 和 PHP8.1,我能够让它与它一起工作......

sudo apt-get install php8.0-intl

Don't forget to do a full apache restart afterwards (either one of these should do it)...之后不要忘记执行完整的 apache 重启(其中任何一个都应该这样做)...

systemctl restart apache2
/etc/init.d/apache2 restart

In addition, this automatically installed the updated 8.1-version...此外,这会自动安装更新的 8.1 版本...

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM