0

New to Laminas, I am following the tutorial "Getting started: A skeleton application".

Close to the end, I am figuring out that I probably answered "no" to the install question about i18n and here I am with a Fatal error: Uncaught Laminas\I18n\Exception\ExtensionNotLoadedException...

The issue should be solved with [Github]https://github.com/laminas/laminas-mvc-i18n and with the component installer. But I still have the error, even after restarting Apache.

Looking back at the installation of the laminas component installer and laminas-mvc-i18n everything looks to be fine. So what?

EDIT 1 Maybe I did not read properly? Here is the full error:

Fatal error: Uncaught Laminas\I18n\Exception\ExtensionNotLoadedException: Laminas\I18n\Translator component requires the intl PHP extension in C:\xampp\htdocs\laminas-mvc-skeleton\vendor\laminas\laminas-i18n\src\Translator\Translator.php:258 Stack trace: #0 C:\xampp\htdocs\laminas-mvc-skeleton\vendor\laminas\laminas-i18n\src\Translator\Translator.php(354): Laminas\I18n\Translator\Translator->getLocale() #1 C:\xampp\htdocs\laminas-mvc-skeleton\vendor\laminas\laminas-mvc-i18n\src\Translator.php(71): Laminas\I18n\Translator\Translator->translate('Laminas MVC Ske...', 'default', NULL) #2 C:\xampp\htdocs\laminas-mvc-skeleton\vendor\laminas\laminas-view\src\Helper\HeadTitle.php(163): Laminas\Mvc\I18n\Translator->translate('Laminas MVC Ske...', 'default') #3 C:\xampp\htdocs\laminas-mvc-skeleton\vendor\laminas\laminas-view\src\Helper\HeadTitle.php(86): Laminas\View\Helper\HeadTitle->Laminas\View\Helper{closure}('Laminas MVC Ske...') #4 C:\xampp\htdocs\laminas-mvc-skeleton\vendor\laminas\laminas-view\src\Helper\HeadTitle.php(70): in C:\xampp\htdocs\laminas-mvc-skeleton\vendor\laminas\laminas-i18n\src\Translator\Translator.php on line 258

So the problem lies in the translator. Which translator? I only use English.

EDIT 2

So I tried again using a new install from scratch. This time I confirmed yes to all options i.e. I replied positively when asked to install i18n and all other options.

And I tested with the Built-in PHP web Server instead of Apache.

The result is the same error!

EDIT 3

List of extensions I have in composer.json

    "laminas/laminas-component-installer": "^1.0 || ^2.1",
    "laminas/laminas-development-mode": "^3.2",
    "laminas/laminas-mvc": "^3.1.1",
    "laminas/laminas-cache": "^2.9.0",
    "laminas/laminas-db": "^2.10.0",
    "laminas/laminas-mvc-form": "^1.0",
    "laminas/laminas-json": "^3.1.2",
    "laminas/laminas-log": "^2.11",
    "laminas/laminas-mvc-console": "^1.2.0",
    "laminas/laminas-mvc-i18n": "^1.1.1",
    "laminas/laminas-mvc-plugins": "^1.0.1",
    "laminas/laminas-psr7bridge": "^1.2.0",
    "laminas/laminas-session": "^2.9.1",
    "laminas/laminas-di": "^3.1.1"
kart-able
  • 106
  • 11
  • Sounds simply like your PHP installation hasn't installed that ext. I'm having a wild guess that you're running OS X? The default installation comes with 7.2 or 7.3 Can you post your configuration by running `php -i` or `phpinfo()` – PeptoLab Mar 29 '20 at 21:51
  • I'm on win10 with PHP 7.4.3. It is true that I can't see i18n when running php -info. Should be there ? – kart-able Mar 30 '20 at 11:38
  • But I can find laminas-mvc-i18n in /vendor/laminas – kart-able Mar 30 '20 at 11:45
  • Composer.json and composer.lock both refer to laminas/laminas-mvc-i18n – kart-able Mar 30 '20 at 11:54
  • I think it's important to say, this ext is not required in the tutorial anyway. – kart-able Mar 30 '20 at 17:45
  • @kart-able you can find required PHP extensions in the composer.json file. In this case, "ext-intl", is in the list of requirements. You could try to use the Intl Polyfill from symfony (https://github.com/symfony/polyfill/) but I'm not sure if that will work. You can however install the intl extension using homebrew. – Frank Houweling Mar 31 '20 at 11:31
  • "ext-intl" is not in the list of required ext in my composer.json. I will add the list of extensions I have in a new edit. Thank you for the suggestion with polyfill. – kart-able Mar 31 '20 at 12:09

1 Answers1

1

As the error says:

Fatal error: Uncaught Laminas\I18n\Exception\ExtensionNotLoadedException: Laminas\I18n\Translator component requires the intl PHP extension

you are lacking INTL PHP extension in you xampp installation. Refer to manual of xampp to install missing extension.

It is true that I can't see i18n when running php -info. Should be there ?

Yes indeed.

yergo
  • 3,965
  • 1
  • 15
  • 39
  • Should be right but I'm still unable to have it work after following https://stackoverflow.com/questions/33869521/how-can-i-enable-php-extension-intl under others. – kart-able Apr 03 '20 at 12:10
  • I have removed the semicolon before extension=intl in my php.ini-development file and even added extension_dir = "ext" before. I'd like to be sure that this ini development file is loaded instead of php.ini (which does not exist - but with a php -i I see Loaded Configuration File => C:\xampp\php\php.ini , which is confusing) – kart-able Apr 03 '20 at 12:57
  • 1
    The files `php.ini-developement` etc are template files. You need to rename particular `php.ini-development` to a `php.ini`. You can not change path, just remove semicolon. Please take your time to follow documentation on XAMP & PHP configuration, other way this is a waste of time. – yergo Apr 03 '20 at 20:47
  • That's OK now. I was made confused by the fact that extensions are not visible in windows on config files and I simply did not see php.ini. I just had to remove the semicolon in THIS file. Thanks, you deserve the bounty. – kart-able Apr 04 '20 at 00:52