Symfony 2: Install and enable the intl extension

前端 未结 7 2436
迷失自我
迷失自我 2021-02-20 04:36

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

7条回答
  •  春和景丽
    2021-02-20 04:49

    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:

    \n";
        echo "ICU: " . INTL_ICU_VERSION . "
    \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

提交回复
热议问题