Symfony 2: Install and enable the intl extension

别来无恙 提交于 2019-12-21 07:55:41

问题


I'm using XAMPP for Windows and decided to try out Symfony 2.

As soon as I get to Symfony Configuration page it recommends me to install and enable intl.

I tried reading PEAR's and PECL's guides, since I'm total 0 on this topic(started learning PHP recently), but nothing worked.

I found php_intl.dll inside 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.dll inside php.ini, so I added it.

Unfortunately it didn't work, and Symfony keeps asking me for intl.


回答1:


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).

also read my comment to your post above




回答2:


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 Panel by clicking the stop/start button in the Apache module row.




回答3:


Follow these steps:

  1. Copy all the file names starting with "icu" from C:\wamp\bin\php\php5.5.12 and paste to C:\wamp\bin\apache\apache2.4.9\bin (I am using WAMP. Figure it out yourself for 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%.

  1. Uncomment the following line on C:\wamp\bin\apache\apache2.4.9\bin\php.ini

    extension=php_intl.dll
    

It will work.




回答4:


For Linux users: Installing php5-intl made it work for me

sudo apt-get install php5-intl

found here: http://www.php.net/manual/en/intl.setup.php




回答5:


For OS X users:

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:

$ which php

(do not copy $ sign, it means than you should type this in Terminal, not php)

You should get: /Applications/XAMPP/xamppfiles/bin/php ,

if not, you will get /usr/bin/php.

This is OSX' php. So, you have to change it to XAMPP' php by using:

$ 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):

$ 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] :

/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:

<?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




回答6:


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 :

;extension=php_intl.dll

Eventually don’t forget to restart Apache !




回答7:


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



来源:https://stackoverflow.com/questions/10218137/symfony-2-install-and-enable-the-intl-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!