Symfony2 中您的系统 (SonataAdminBundle) 中缺少请求的 PHP 扩展 intl

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17698434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:17:46  来源:igfitidea点击:

The requested PHP extension intl is missing from your system (SonataAdminBundle) in Symfony2

phpsymfonyintl

提问by Krishna Ghodke

I try to install the sandbox but I get the following error from composer:

我尝试安装沙箱,但从 Composer 收到以下错误:

Loading composer repositories with package information Installing dependencies from lock file Your requirements could not be resolved to an installable set of packages.

使用包信息加载 Composer 存储库 从锁定文件安装依赖项 您的要求无法解析为一组可安装的包。

Problem 1

问题一

- Installation request for sonata-project/intl-bundle 2.1.0 -> satisfiable by sonata-project/intl-bundle 2.1.0.`

- sonata-project/intl-bundle 2.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.`

Problem 2

问题二

- sonata-project/intl-bundle 2.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.`

- sonata-project/news-bundle 2.1.x-dev requires sonata-project/intl-bundle 2.1.* -> satisfiable by sonata-project/intl-bundle 2.1.0.
- Installation request for sonata-project/news-bundle 2.1.

采纳答案by Sohaib Afzal

I had the same problem while I was installing new Magento 2.0, after different hit and trials, I manged to solve it by following these steps:

我在安装新的 Magento 2.0 时遇到了同样的问题,经过不同的尝试和试验,我设法通过以下步骤解决它:

I copied all icu*files from php directory to Appache directory, and it worked.

我将所有icu*文件从 php 目录复制到 Appache 目录,并且它工作正常。

Php direcotry:

PHP目录:

WAMP\bin\php\php5.5.12

WAMP\bin\php\php5.5.12

Appache Directory:

应用目录:

WAMP\bin\apache\apache2.4.9

WAMP\bin\apache\apache2.4.9

Make sure to un-comment following line in php.ini file:

确保取消注释 php.ini 文件中的以下行:

extension=ext/php_intl.dll

扩展=ext/php_intl.dll

回答by Dharmendra Singh

Linux user

Linux用户

yum install php-intl

回答by eroteev

Like @Hugehornet pointed out - you should enable this extension in php.ini by uncommenting this line: extension=ext/php_intl.dll

就像@Hugehornet 指出的那样 - 你应该通过取消注释这一行来在 php.ini 中启用这个扩展:extension=ext/php_intl.dll

If you use wamp's interface for this task you are actually updating the php.ini file located in apache's directory.

如果您为此任务使用 wamp 的界面,您实际上是在更新位于 apache 目录中的 php.ini 文件。

Example: C:\wamp\bin\apache\Apache2.4.4\bin\php.ini

示例:C:\wamp\bin\apache\Apache2.4.4\bin\php.ini

Composer is using the one located in the php's installation directory.

Composer 正在使用位于 php 安装目录中的那个。

Example: C:\wamp\bin\php\php5.4.12\php.ini

示例:C:\wamp\bin\php\php5.4.12\php.ini

You should manually edit the latter and restart the wamp server.

您应该手动编辑后者并重新启动 wamp 服务器。

回答by Hugehornet

You need to enable the intl extension in php just as the error says. In your php.ini file, uncomment the line extension=ext/php_intl.dllor something like this.

正如错误所说,您需要在 php 中启用 intl 扩展。在您的 php.ini 文件中,取消注释该行extension=ext/php_intl.dll或类似内容。

Edit : note that if you are using wamp or something like this, you should be aware of the fact that the php.ini file in the wamp config is not necessarily the one used by composer.

编辑:请注意,如果您使用 wamp 或类似的东西,您应该意识到 wamp 配置中的 php.ini 文件不一定是 Composer 使用的文件。

回答by Hugehornet

First of all be sure that your server is isung x86 build (intl not working with x64), then:

首先确保您的服务器是 isung x86 构建(intl 不适用于 x64),然后:

  • activate intl extension in php.inidirectly
  • copy all icu*.dllform php directory to apache directory
  • make sure your console using the same php folder you just configured source.
  • php.ini直接激活国际扩展
  • 将所有icu*.dll表单php目录复制到apache目录
  • 确保您的控制台使用与您刚刚配置source相同的 php 文件夹 。

In my windows system I have two php.inifiles at the flowing paths:

在我的 Windows 系统中,我php.ini在流动路径中有两个文件:

C:\wamp\bin\php\phpx.y.z
C:\wamp\bin\apache\Apachex.y.z\bin

I don't know which one is in your path. Just make sure to add the extension in both of them to eliminate any doubt.

我不知道你的路径是哪一个。只需确保在它们两个中添加扩展名即可消除任何疑问。

回答by cyber8200

I am on a Mac OS X Yosemite, and I fix this error

我在 Mac OS X Yosemite 上,我修复了这个错误

the requested PHP extension mcrypt is missing from your system

您的系统中缺少请求的 PHP 扩展 mcrypt

by running the following commands :

通过运行以下命令:

brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt

回答by quent

If intl has already been enabled and it doesn't works, add your PHP directory in the Path environment variable, then restart your server. (for example C:\Program Files\wamp\bin\php\phpX.XXX.XXX for wamp)

如果已经启用了 intl 并且它不起作用,请在 Path 环境变量中添加您的 PHP 目录,然后重新启动您的服务器。(例如 C:\Program Files\wamp\bin\php\phpX.XXX.XXX 表示 wamp)

It has worked for me!

它对我有用!

回答by Alexey

On Ubuntu, Debian, and related Linux distributions

在 Ubuntu、Debian 和相关的 Linux 发行版上

sudo apt-get install php-intl

to install the extension for the default PHP version. For other versions a variation like apt-get install php7.3-intlwill choose the correct extension if the version provided is correct.

安装默认 PHP 版本的扩展。对于其他版本,apt-get install php7.3-intl如果提供的版本正确,则变体 like将选择正确的扩展名。