简体   繁体   中英

How to make composer recognize intl php extension

I'm trying to install some symfony bundles to create an admin tool found in this tutorial: http://www.ens.ro/2012/07/13/symfony2-jobeet-day-12-the-admin-bundle/

I'm using symfony 2.3.* and am using composer for my dependencies as described here: Cannot setup sonata using composer

but when I try to update my symfony buid as described in the above composer file (php composer.phar update) , I get this error:

  • Installation request for sonata-project/intl-bundle dev-master -> satisfiable by sonata-project/intl-bundle[dev-master].
    • sonata-project/intl-bundle dev-master requires ext-intl * -> the requested PHP extension intl is missing from your system.

now I know that the php intl extension is installed because it shows up in my info.php file (pictured here): http://johnpaulwhatnow.com/intl.png

so why does composer/symfony think the intl extension isn't installed?

Specs: Mamp| php 5.4.10| symfony 2.3.6

EDIT: I did find this error in my php error log:

[24-Oct-2013 14:05:11 America/Chicago] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/intl.so' - dlopen(/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/intl.so, 9): Symbol not found: _zend_new_interned_string Referenced from: /Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/intl.so Expected in: flat namespace in /Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/intl.so in Unknown on line 0

Solved

I had to tell my CLI to use mamp's php, which had intl.so installed. I did this by creating a alias: alias phpmamp='/Applications/MAMP/bin/php/php5.4.19/bin/php'

then running the command I needed: phpmamp composer.phar update --prefer-dist

thank you for your answers!

Because you probably have two php.ini... one for cli and apache.

You have to load intl extension in both.

EDIT

To find the php.ini that is used when php scripts run from cli use this command in the terminal:

php -r 'phpinfo();' | grep 'php.ini'

Composer is a command line tool, it uses the PHP CLI version, and this usually has a DIFFERENT php.ini than the PHP running inside the web server.

Please run php -i on the command line and check if the intl extension is mentioned. I suppose it is not. Also it would be a good idea to fix your error with that extension. This could be related - the CLI version might have triggered the error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM