简体   繁体   English

如何使作曲家认识国际PHP扩展

[英]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/ 我正在尝试安装一些symfony捆绑包以创建在本教程中找到的管理工具: 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 我正在使用symfony 2.3。*,并使用composer来建立我的依赖关系,如下所述: 无法使用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: 但是当我尝试按照上述作曲家文件(php composer.phar更新)中所述更新我的symfony buid时,出现此错误:

  • Installation request for sonata-project/intl-bundle dev-master -> satisfiable by sonata-project/intl-bundle[dev-master]. sonata-project / intl-bundle dev-master的安装请求-> 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. sonata-project / intl-bundle dev-master需要ext-intl *->您的系统中缺少所请求的PHP扩展intl。

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 现在我知道已经安装了php intl扩展名,因为它显示在我的info.php文件中(如图所示): http : //johnpaulwhatnow.com/intl.png

so why does composer/symfony think the intl extension isn't installed? 那么,为什么作曲家/ symfony认为未安装intl扩展名?

Specs: Mamp| 规格:Mamp | php 5.4.10| php 5.4.10 | symfony 2.3.6 symfony 2.3.6

EDIT: I did find this error in my php error log: 编辑:我确实在我的php错误日志中找到此错误:

[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 [2013年10月24日14:05:11美国/芝加哥] PHP警告:PHP启动:无法加载动态库'/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):符号找不到:_zend_new_interned_string引用自:/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/intl.so预期使用:/ Applications / MAMP /中的平面命名空间第0行上的未知中的bin / php / php5.4.10 / lib / php / extensions / no-debug-non-zts-20100525 / intl.so

Solved 解决了

I had to tell my CLI to use mamp's php, which had intl.so installed. 我不得不告诉CLI使用mamp的php,该php已安装了intl.so。 I did this by creating a alias: alias phpmamp='/Applications/MAMP/bin/php/php5.4.19/bin/php' 我通过创建别名来做到这一点:alias phpmamp ='/ Applications / MAMP / bin / php / php5.4.19 / bin / php'

then running the command I needed: phpmamp composer.phar update --prefer-dist 然后运行我需要的命令:phpmamp composer.phar update --prefer-dist

thank you for your answers! 谢谢您的回答!

Because you probably have two php.ini... one for cli and apache. 因为您可能有两个php.ini ...一个用于cli和apache。

You have to load intl extension in both. 您必须同时加载intl扩展名。

EDIT 编辑

To find the php.ini that is used when php scripts run from cli use this command in the terminal: 要查找从cli运行php脚本时使用的php.ini,请在终端中使用以下命令:

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. Composer是一个命令行工具,它使用PHP CLI版本,并且与运行在Web服务器内部的PHP相比,它通常具有不同的php.ini。

Please run php -i on the command line and check if the intl extension is mentioned. 请在命令行上运行php -i并检查是否提到了intl扩展名。 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. 这可能是相关的-CLI版本可能触发了错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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