Installing the php_intl extension

Enabling php_intl extension

If you need internationalization extension (php_intl.dll), and you have similar development environment as I have, then follow this steps:

Open Ampps manager under PHP , enable internationalization extension (php_intl.dll) and click Apply.

2015-09-16 22_41_09-Program ManagerThat was simple , yes ?

To check if extension is available, you need to start “php -i” in command line and search for “intl” :

H:\>php -i

Well, I got this error:

The procedure entry point __crtCreateSymbolicLinkW could not be located in the dynamic link library MSVCR110.dll

The procedure entry point __crtCreateSymbolicLinkW could not be located in the dynamic link library MSVCR110.dll

We need latest Visual C++ Runtime, but even if we have one on the windows installed, something prevent PHP to load correct DLL.

After a while and lot of experimenting I figure out that MSVCR110.dll is installed in PHP folder as part of Ampps installation (H:\Ampps\php folder for me). Windows will load this local DLL from folder where program started and will not search for one on the system.

I just rename dll file to something else (“not_used_MSVCR110.dll”) and check again. This time “php -i” was executed without errors and I found “intl” settings in generated output .

intl

Internationalization support => enabled
version => 1.1.0
ICU version => 51.2
ICU Data version => 51.2

There is one more location where MSVCR110.dll is installed (H:\Ampps\apache\bin). This is obviously inside apache runtime system and I renamed that too.

I am not sure if this is the best way to solve this problem, but for now I am satisfied.

 

Symfony – demo application

Install demo application

Symfony provide demo application as a learning resource.  To install it just enter “demo” as parameter to “symfony” command.

H:\Ampps\www>symfony demo

Start demo application

To start newly installed app, navigate to:

http://localhost/symfony_demo/web/app_dev.php

First page of application :

2015-09-16 21_53_17-Symfony Demo applicationIf demo application doesn’t work as expected and you get error like this :

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 blog/post_show.html.twig at line 35.

Just repair one line of php code in “IntlDateFormatter.php” file, as described in details in this fix .

File is placed inside demo app source tree , in my case this is:

H:\Ampps\www\symfony_demo\vendor\symfony\symfony\src\Symfony\Component\Intl\DateFormatter\IntlDateFormatter.php

Open file and change first “if” statement in “__constructor” method to reflect second line :

-        if ('en' != $locale) {
+        if ('en' !== $locale && null !== $locale) {

Save file and navigate to application again, this time should work as expected.