我正在尝试运行使用 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/