Intl working fine with Symfony2 on WAMP, but shows

2019-08-02 19:03发布

问题:

I have a quite strange issue here!

I am using Symfony2 with WAMP. When I visualise a path, lets say

mylocaldomain/blog/see_all

it works fine (Intl extension on PHP works fine).

However, when I build a functional test, there is this issue

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 ...

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?

回答1:

Thanks to @Himal (see comments above), here is the solution:

The php.ini used by the WAMP and by the console are not the same (php --ini for the one in the console).

I enabled in both of them the Intl extension

extension=php_intl.dll

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").



标签: php symfony intl