Problems with lib-icu dependency when installing Symfony 2.3.x via Composer

后端 未结 6 528
轻奢々
轻奢々 2020-12-04 08:48

I\'ve had no problems installing Symfony 2.2.x using Composer, I\'ve always just copied the stable version at http://symfony.com/download.

composer create-pr         


        
相关标签:
6条回答
  • 2020-12-04 09:14

    A better solution is to fix your composer.json to the version required by the production server. First, determine the ICU version on the server: 1 2

    $ php -i | grep ICU
    ICU version => 4.2.1
    

    Then fix the Icu component in your composer.json file to a matching version:

    "require: {
        "symfony/icu": "1.1.*"
    }
    

    Set the version to "1.0." if the server does not have the intl extension installed; "1.1." if the server is compiled with ICU 4.2 or lower.

    Finally, run

    php composer.phar update symfony/icu
    

    on your development machine, test extensively and deploy again. The installation of the dependencies will now succeed.

    0 讨论(0)
  • 2020-12-04 09:24

    I know that this answer may not be the correct answer to this person's problem, but it was the solution to my problem with the same title. I was able to fix this problem for myself by enabling the intl extension in php.ini and upgrading composer.

    Upgrading composer.

    php composer.phar self-update
    

    Remove comment from this line (in php.ini):

    extension=php_intl.dll
    

    And also remove comment the these two lines below [intl] in (php.ini):

    [intl]
    intl.default_locale = en_utf8
    intl.error_level = E_WARNING
    

    And restart apache2 of course. :)

    Additional Information:

    If your using mac and installed php with Homebrew follow these steps:

    (PHP 5.4)

    $ brew install php54-intl
    

    (PHP 5.5)

    $ brew tap josegonzalez/php
    $ brew tap homebrew/dupes
    $ brew install josegonzalez/php/php55-intl
    $ sudo apachectl restart
    

    Restart apache.

    0 讨论(0)
  • 2020-12-04 09:30

    Many applications will only be supporting "en" locale and will have no need for translation capabilities or php-intl. If this is you, or you can't install php-intl on your server, you can explicitly add symfony/icu ~1.0 to your composer.json. 1.0 does not require php-intl, whereas 1.1+ does.

    If you don't need translation features:

    $ php bin/composer.phar require symfony/icu ~1.0
    

    Without this declaration and trying to install symfony/symfony 2.3 Composer may try to install symfony/icu ~1.2 which would require you to install php-intl.

    This is explicitly covered more extensively in the Symfony Intl Component's docs under "ICU and Deployment Problems".

    0 讨论(0)
  • 2020-12-04 09:31

    Mac OS Mavericks comes with PHP 5.4.17 without intl. To get this, you'll have to follow those steps :

    brew install icu4c
    sudo pecl install intl 
    The path to the ICU libraries and headers is: /usr/local/opt/icu4c/
    Edit /etc/php.ini and add extension=intl.so to the end.
    
    0 讨论(0)
  • 2020-12-04 09:32

    A solution regarding this or similar problems can be found here: ICU and Deployment Problems

    The behavior of composer should be intelligent selecting the right icu-component:

    • symfony/icu 1.0.*: when the intl extension is not available
    • symfony/icu 1.1.*: when intl is compiled with ICU 4.0 or higher
    • symfony/icu 1.2.*: when intl is compiled with ICU 4.4 or higher

    There should be (theoretically) no error installing symfony 2.3. with no intl-extension.

    But you can be trapped when your development-environment differs from your production-server like mentioned in this article:

    • the development machines are compiled with ICU 4.4 or higher, but the server is compiled >with a lower ICU version than 4.4
    • the intl extension is available on the development machines but not on the server.

    When you have no root-access to your production-server you can fix it as mentioned in this article. (tweaking composer.json)

    Hope this additional information helped as it helped me for this special case with different environments.

    0 讨论(0)
  • 2020-12-04 09:34

    update your php-intl extension, that's where the icu error comes from!

    sudo aptitude install php5-intl                 // i.e. ubuntu
    brew install icu4c                              // osx
    

    check the extension is enabled and properly configured in php.ini aswell.

    ( hint: php-cli sometimes uses a different php.ini )

    php.ini

    extension=intl.so       ; *nix
    extension=php_intl.dll  ; windows
    
    [intl]
    intl.default_locale = en_utf8
    intl.error_level = E_WARNING
    

    check your phpinfo() AND php -m from your terminal if the extension has been succesfully enabled.

    Check your current intl versions from php with:

    Intl::getIcuVersion();
    Intl::getIcuDataVersion();
    

    attention: not needed anymore ( symfony 2.3 has meanwhile been released )

    add the minimum stability flag @dev or @rc to your dependency like this please:

    composer create-project symfony/framework-standard-edition mynewerproject/ 2.3.*@dev 
    

    The default stability in composer is stable which symfony 2.3 branch is not currently ( it's @rc ). Read more an stability flags here.

    0 讨论(0)
提交回复
热议问题