PHP7.2 缺少国际扩展

标签 php php-7.2 intl

我正在尝试运行使用 locale_accept_from_http 的 php 应用程序从国际扩展功能。我的php版本是7.2我收到一个错误:Call to undefined function locale_accept_from_http() ;

我在尝试:

1.安装扩展sudo apt-get install php-intl .
错误是:

Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies: php-intl : Depends: php7.1-intl but it is not going to be installed E: Unable to correct problems, you have held broken packages.



2. 在 php.ini 中启用 intl 扩展。
我收到警告:

PHP Warning: PHP Startup: Unable to load dynamic library 'intl'



将这个扩展与 php7.2 一起使用的正确方法是什么? ?

最佳答案

正如它在您的错误中所述,您的软件包已损坏,因此在这种情况下,您应该尝试修复它,可能以下命令会修复它们。

apt update
apt autoremove

一旦你解决了这个问题,如果你没有添加 ondrej PPA,你可以尝试执行以下命令:
add-apt-repository -y ppa:ondrej/php
apt install php7.2 php7.2-intl

关于PHP7.2 缺少国际扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53921992/

相关文章:

php - 功能类似于 ctype_alpha 但带有特殊字母

php - 当您只插入几行时,MySQL 中的单个多个 INSERT 是否会在速度上产生很大差异?

PHP 7.2 警告 : "Cannot change session name when session is active"

php - symfony simple-phpunit 错误 'You have requested a non-existent service "test.client"' 仅在部署脚本中

php - 使用 NoRewindIterator 实现 foreach 的正确方法

cmake - 在 cmake 中使用 intltool

php - 从表中删除所有行,并重置自动递增

php - 在 Laravel 4 中捕获错误异常

flutter - 如何在 Flutter 中导入 intl 库?

android - FLUTTER:多屏应用程序的本地化