php Symfony 2:安装并启用 intl 扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10218137/
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
Symfony 2: Install and enable the intl extension
提问by Bob
I'm using XAMPP for Windowsand decided to try out Symfony 2.
我正在使用XAMPP for Windows并决定尝试一下Symfony 2。
As soon as I get to Symfony Configurationpage it recommends me to install and enable intl.
一旦我到达Symfony Configuration页面,它就会建议我安装并启用intl。
I tried reading PEAR'sand PECL'sguides, since I'm total 0on this topic(started learning PHPrecently), but nothing worked.
我尝试阅读PEAR's和PECL's指南,因为我在这个主题上的总分为0(PHP最近开始学习),但没有任何效果。
I found php_intl.dllinside my C:\xamp\php\ext. The php.ini's extension_dir=is set to "C:\xampp\php\ext". I was only missing the extension=php_intl.dllinside php.ini, so I added it.
我php_intl.dll在我的C:\xamp\php\ext. 该php.ini的extension_dir=设置为"C:\xampp\php\ext"。我只是缺少extension=php_intl.dll内部php.ini,所以我添加了它。
Unfortunately it didn't work, and Symfonykeeps asking me for intl.
不幸的是它没有用,并Symfony一直问我intl。
采纳答案by Hajo
http://php.net/manual/en/intl.requirements.php
http://php.net/manual/en/intl.requirements.php
This extension is bundled with PHP as of PHP version 5.3.0. Alternatively, the PECL version of this extension may be used with all PHP versions greater than 5.2.0 (5.2.4+ recommended).
自 PHP 5.3.0 版起,此扩展与 PHP 捆绑在一起。或者,此扩展的 PECL 版本可用于所有高于 5.2.0(推荐 5.2.4+)的 PHP 版本。
also read my comment to your post above
还请阅读我对您上面的帖子的评论
回答by ThomasPeeters
Whenever you make changes to php.ini, remember to restart Apache. Otherwise the changes won't take effect. You can do this in the XAMPP Control Panelby clicking the stop/startbutton in the Apachemodule row.
无论何时对 进行更改php.ini,请记住重新启动Apache。否则更改不会生效。您可以XAMPP Control Panel通过单击模块行中的stop/start按钮来执行此操作Apache。
回答by srbhattarai
Follow these steps:
按着这些次序:
- Copy all the file names starting with "icu" from C:\wamp\bin\php\php5.5.12and paste to C:\wamp\bin\apache\apache2.4.9\bin(I am using WAMP. Figure it out yourself for XAMP.)
- 将所有以“ icu”开头的文件名从C:\wamp\bin\php\php5.5.12 复制并粘贴到C:\wamp\bin\apache\apache2.4.9\bin(我正在使用 WAMP。自己弄清楚用于 XAMP。)
You can try. Nothing will harm. If you feel the things are not working, you can delete them. I am sure it will work for you 100%.
你可以试试。什么都不会伤害。如果你觉得这些东西不起作用,你可以删除它们。我相信它会 100% 为您服务。
Uncomment the following line on C:\wamp\bin\apache\apache2.4.9\bin\php.ini
extension=php_intl.dll
取消注释 C:\wamp\bin\apache\apache2.4.9\bin\php.ini 上的以下行
extension=php_intl.dll
It will work.
它会起作用。
回答by Julian Orinyol
For Linux users: Installing php5-intl made it work for me
对于 Linux 用户:安装 php5-intl 对我有用
sudo apt-get install php5-intl
found here: http://www.php.net/manual/en/intl.setup.php
回答by Stan Fad
For OS X users:
对于 OS X 用户:
1.Normally, the PHP is automatically installed on OSX. So, if you would like to use the XAMPP, or whatever apache server, you must change the path point to XAMPP. You can check the path by using:
1.通常情况下,PHP 会自动安装在 OSX 上。因此,如果您想使用 XAMPP 或任何 apache 服务器,您必须更改指向 XAMPP 的路径。您可以使用以下方法检查路径:
$ which php
(do not copy $ sign, it means than you should type this in Terminal, not php)
(不要复制 $ 符号,这意味着您应该在终端而不是 php 中输入它)
You should get: /Applications/XAMPP/xamppfiles/bin/php,
你应该得到:/Applications/XAMPP/xamppfiles/bin/php,
if not, you will get /usr/bin/php.
如果没有,你会得到/usr/bin/php。
This is OSX' php. So, you have to change it to XAMPP' php by using:
这是 OSX 的 php。因此,您必须使用以下命令将其更改为 XAMPP' php:
$ PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
2.Run this command to download, unpack, compile and install ICU (you can choose different version is your Symfony required):
2.运行此命令下载、解压、编译和安装ICU(你可以选择不同的版本是你需要的Symfony):
$ curl -sS -o /tmp/icu.tar.gz -L http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz && tar -zxf /tmp/icu.tar.gz -C /tmp && cd /tmp/icu/source && ./configure --prefix=/usr/local && make && sudo make install
than run:
比运行:
$ sudo pecl install intl
and specify where ICU libraries and headers can be found [DEFAULT] :
并指定 ICU 库和头文件的位置 [DEFAULT] :
/usr/local
Pay attention to information in install report:
注意安装报告中的信息:
You should add "extension=intl.so" to php.ini
Don't forget to reboot Apache and check version:
不要忘记重新启动Apache并检查版本:
<?php
if (extension_loaded('intl')) {
echo "PHP: " . PHP_VERSION . "<br>\n";
echo "ICU: " . INTL_ICU_VERSION . "<br>\n";
} else {
die('OOPS! The intl extension is not enabled!');
}
Partially taken from here but modified to get success Install PHP Internationalization extension (Intl) on XAMPP on Mac
部分取自此处但经过修改以获得成功在 Mac 上的 XAMPP 上安装 PHP 国际化扩展 (Intl)
回答by BEN ZAYAD
To solve this go to "c:\xampp\php\php.ini" open it in your editor and search for Dynamic Extensions then go down search for ;extension=php_intl.dll and enable it(remove ; to became like ) extension=php_intl.dll after that save your file php.ini and restart your localhost
要解决此问题,请转到“c:\xampp\php\php.ini”,在编辑器中打开它并搜索 Dynamic Extensions,然后向下搜索 ;extension=php_intl.dll 并启用它(删除 ; 变得像 ) extension= php_intl.dll 之后保存您的文件 php.ini 并重新启动您的本地主机
回答by Charles
To activate this extension in Xampp, just edit your php.ini (i.e. in C:\xampp\php directory) and remove the semicolon to uncomment this line :
要在 Xampp 中激活此扩展,只需编辑您的 php.ini(即在 C:\xampp\php 目录中)并删除分号以取消注释此行:
;extension=php_intl.dll
Eventually don't forget to restart Apache !
最后不要忘记重新启动 Apache !

