Intl与Symfony2在WAMP上正常工作,但在功能测试中显示错误 [英] Intl working fine with Symfony2 on WAMP, but shows an error in Functional Tests
问题描述
我这里有一个很奇怪的问题!
I have a quite strange issue here!
我正在将 Symfony2 与WAMP一起使用.当我可视化路径时,可以说
I am using Symfony2 with WAMP. When I visualise a path, lets say
mylocaldomain/blog/see_all
工作正常(PHP上的Intl扩展工作正常).
it works fine (Intl extension on PHP works fine).
但是,当我进行功能测试时,会出现此问题
However, when I build a functional test, there is this issue
500内部服务器错误-Twig_Error_Runtime:
呈现模板期间引发了异常
("Symfony \ Component \ Intl \ DateFormatter \ IntlDateFormatter :: __ construct()方法的参数$ locale值NULL行为未实现.仅支持语言环境"en".请安装"intl"扩展名以获得完整的本地化功能." )在...
500 Internal Server Error - Twig_Error_Runtime:
An exception has been thrown during the rendering of a template
("The Symfony\Component\Intl\DateFormatter\IntlDateFormatter::__construct() method's argument $locale value NULL behavior is not implemented. Only the locale "en" is supported. Please install the "intl" extension for full localization capabilities.") in ...
我认为使用了php.ini
的2个版本.如果这是问题所在,如何知道哪个用于测试?
I think 2 version of php.ini
were used. If this is the problem, how to know which one is used for tests?
如果这不是问题,有什么线索吗?
If this is not the problem, any clues?
推荐答案
感谢@Himal(请参见上面的评论),这是解决方案:
Thanks to @Himal (see comments above), here is the solution:
WAMP和控制台使用的php.ini
不同(控制台中使用的php --ini
).
The php.ini
used by the WAMP and by the console are not the same (php --ini
for the one in the console).
我在他们两个人中都启用了 Intl扩展名
I enabled in both of them the Intl extension
extension=php_intl.dll
另一种解决方案是使控制台使用与WAMP相同的文件(我没有探索此解决方案,但是在我看来,它更干净").
Another solution is to make the console, use the same file as WAMP (I did not explore this solution, but it seems to me to be "cleaner").
这篇关于Intl与Symfony2在WAMP上正常工作,但在功能测试中显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!