[英]PHP intl extension is installed, but CakePHP install says it is missing
For over a day I have been trying to start a CakePHP 3 project. 整整一天的时间,我一直在尝试启动CakePHP 3项目。 When I run the composer install command, I get the following error: 当我运行composer install命令时,出现以下错误:
cakephp/cakephp 3.3.x requires ext-intl * -> the requested PHP extension intl is missing from your system.
I am using MacOS Sierra 10.12.2. 我正在使用MacOS Sierra 10.12.2。 XCode and all that jazz are fully up-to-date. XCode和所有爵士乐都是最新的。 I am running PHP 5.6.25 via MAMP Pro 4.0.1 (3985). 我正在通过MAMP Pro 4.0.1(3985)运行PHP 5.6.25。 And I am trying to install CakePHP 3.3.x through my terminal, which is using ZSH instead of Bash. 我试图通过我的终端安装CakePHP 3.3.x,该终端使用ZSH而不是Bash。
I've spent quite a while trying to get intl installed. 我花了很长时间尝试安装intl。 And by now I'm pretty confident that it is indeed installed: 现在,我非常有信心它确实已安装:
php -m
I see intl
in the list of PHP modules. 当我运行php -m
我在PHP模块列表中看到了intl
。 extension=intl.so
in my php.ini, located in /Applications/MAMP/bin/php/php5.6.25/conf/php.ini
. 我在php.ini中具有extension=intl.so
,位于/Applications/MAMP/bin/php/php5.6.25/conf/php.ini
。 intl.so
is located in the directory /Applications/MAMP/bin/php/php5.6.25/lib/php/extensions/no-debug-non-zts-20131226
. 文件intl.so
位于目录/Applications/MAMP/bin/php/php5.6.25/lib/php/extensions/no-debug-non-zts-20131226
。 '--enable-intl'
in the Configure Command cell. 在MAMP的phpinfo页面上,我可以在Configure Command单元中看到'--enable-intl'
。 Further down the page, it has its own table, showing that internationalization is supported with version 1.1.0. 在页面的下方,它具有自己的表,显示版本1.1.0支持国际化。 However, in this table, for the row intl.default_locale
the value is no value
. 但是,在此表中,对于intl.default_locale
行,该值为no value
。 Could this be my problem? 这可能是我的问题吗? ~/.zshrc
file I have alias php="/Applications/MAMP/bin/php/php5.6.25/bin/php"
so I can be sure I'm using the correct version and installation of PHP. 在我的~/.zshrc
文件中,我有alias php="/Applications/MAMP/bin/php/php5.6.25/bin/php"
因此可以确定使用的是正确的PHP版本和安装。 I hope I haven't ruined anything by trying to use so many articles and StackOverflow answers to get this working. 我希望我不会因为尝试使用那么多文章和StackOverflow答案而破坏了任何事情,以使它正常工作。 I know there are a number of similar intl
questions here, but so far I've had no luck with any answers. 我知道这里有许多类似的intl
问题,但到目前为止,我还没有任何答案。
So I suppose here are my two main questions: 所以我想这是我的两个主要问题:
intl
extension correctly installed, and why does CakePHP still complain about the extension being missed if it is correctly installed? 我上面列出的证据足以表明我确实已经正确安装了intl
扩展吗?为什么CakePHP仍然抱怨如果正确安装了扩展,会丢失该扩展? Thank you! 谢谢!
Thank you to everyone who lent a hand in the comments. 感谢所有发表评论的人。 But a special thank you to Aman Rawat for pointing me to this answer . 但是特别感谢Aman Rawat指出我的答案 。 I've read through that thread a number of times, but apparently overlooked it. 我已经多次阅读该线程,但显然忽略了它。
I added export PATH="/Applications/MAMP/bin/php/php5.6.25/bin:$PATH"
to ~/.zshrc
. 我在~/.zshrc
export PATH="/Applications/MAMP/bin/php/php5.6.25/bin:$PATH"
添加了export PATH="/Applications/MAMP/bin/php/php5.6.25/bin:$PATH"
。
I was then able to install CakePHP via composer
.\\ 然后,我能够通过composer
安装CakePHP。
I assumed I had MAMP's PHP in my path. 我以为自己有MAMP的PHP。 I had it as an alias, so php
in terminal would correctly point to MAMP's PHP install, but it turns out that PHP was never actually in my PATH. 我将其作为别名,因此终端中的php
会正确指向MAMP的PHP安装,但事实证明PHP实际上从未出现在我的PATH中。
Oops! 糟糕!
我认为您尚未从php.ini文件启用intl扩展名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.