0

I installed magento 2.3.5-p1 in Mamp on my Mac. Now I wanted to add a module, but I get the command

bin/magento setup:upgrade

the error code

Running schema recurring...PHP Fatal error:  Uncaught Error: Class 'IntlDateFormatter' not found in /Users/ingokrah/Sites/aquamed/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121 Stack trace: 
#0 /Users/ingokrah/Sites/aquamed/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array) 
#1 /Users/ingokrah/Sites/aquamed/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...') 
#2 /Users/ingokrah/Sites/aquamed/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(167): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...') 
#3 /Users/ingokrah/Sites/aquamed/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(273): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'localeDate', 'Magento\\Framewo...') 
#4 /Users/ingokrah/Sites/aquamed in /Users/ingokrah/Sites/aquamed/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121
{"messages":{"error":[{"code":500,"message":"Server internal error. See details in report api\/365677830219"}]}}%

The extension php-intl is installed and activated because the query in the bash is successful

▶ php -i | grep intl

Configure Command =>  './configure'  '--with-gd' '--with-jpeg-dir=/Applications/MAMP/Library' '--with-png-dir=/Applications/MAMP/Library' '--with-zlib' '--with-zlib-dir=/Applications/MAMP/Library' '--with-freetype-dir=/Applications/MAMP/Library' '--prefix=/Applications/MAMP/bin/php/php7.3.9' '--exec-prefix=/Applications/MAMP/bin/php/php7.3.9' '--sysconfdir=/Applications/MAMP/bin/php/php7.3.9/conf' '--with-config-file-path=/Applications/MAMP/bin/php/php7.3.9/conf' '--enable-ftp' '--with-bz2=/Applications/MAMP/Library' '--with-mysqli=mysqlnd' '--enable-mbstring=all' '--with-curl=/Applications/MAMP/Library' '--enable-sockets' '--enable-bcmath' '--with-imap=shared,/Applications/MAMP/Library/lib/imap-2007f' '--with-imap-ssl=/Applications/MAMP/Library' '--enable-soap' '--with-kerberos' '--enable-calendar' '--with-pgsql=shared,/Applications/MAMP/Library/pg' '--enable-exif' '--with-libxml-dir=/Applications/MAMP/Library' '--with-gettext=shared,/Applications/MAMP/Library' '--with-xsl=/Applications/MAMP/Library' '--with-pdo-mysql=mysqlnd' '--with-pdo-pgsql=shared,/Applications/MAMP/Library/pg' '--with-openssl=/Applications/MAMP/Library' '--enable-zip' '--with-pcre-dir=/Applications/MAMP/Library' '--with-libzip=/Applications/MAMP/Library' '--with-iconv=/Applications/MAMP/Library' '--enable-opcache' '--enable-intl' '--with-tidy=shared' '--with-icu-dir=/Applications/MAMP/Library' '--enable-wddx' '--with-libexpat-dir=/Applications/MAMP/Library' '--with-readline' '--with-mhash' '--with-iconv-dir=/Applications/MAMP/Library' '--with-sodium=/Applications/MAMP/Library' '--with-password-argon2=/Applications/MAMP/Library' '--enable-cgi' '--disable-phpdbg' 'YACC=/Applications/MAMP/Library/bin/bison'
intl
intl.default_locale => no value => no value
intl.error_level => 0 => 0
intl.use_exceptions => 0 => 0

The phpinfo also confirms that php-intl is active.

What can be the source of the error?

teccrow

teccrow
  • 85
  • 1
  • 9
  • I don't know anything about Magento so sorry if it's a dumb question but... What does `bin/magento` contain? Does it by chance have a hard-coded path to php interpreter? – Álvaro González May 19 '20 at 16:24
  • What happens when you use `IntlDateFormatter ` in `php -a` console ? – cyildirim May 20 '20 at 00:00
  • @cyildirim when i use the shell and for example, then it's okay `php > $DateTime = new DateTime(); php > $IntlDateFormatter = new IntlDateFormatter( php ( 'de_DE', php ( IntlDateFormatter::FULL, php ( IntlDateFormatter::FULL php ( ); php > echo $IntlDateFormatter->format($DateTime);` Mittwoch, 20. Mai 2020 um 05:50:18 GMT – teccrow May 20 '20 at 06:14
  • I would suggest you to restart your php-fpm and clear cache. I can't see any other reason for this to not work. – cyildirim May 20 '20 at 13:19

2 Answers2

0

Switch to developer mode if you are not already.

bin/magento deploy:mode:set developer

Clear cache and clear generated/ folder.

bin/magento cache:flush
rm -rf generated/*

And after that run bin/magento setup:upgrade

sudmak
  • 1
  • I have cleared the cache and the generated folder, but when i run `bin/magento setup:upgrade` have the same error message. I also restarted the apache before that! – teccrow May 20 '20 at 19:40
0

The solution was now easier than expected. There was a conflict between the Mamp Apache server and the Macos Apache server.

Although the path export PATH="/Applications/MAMP/bin/php/php7.3.9/bin:$PATH" is available in the .bash_profile file, macos php was accessed when executing bin/ magento and no intl module is enabled there.

I restarted the terminal app and ran the source ~/.bash_profile. Then bin/magento setup:upgrade ran successfully

teccrow
  • 85
  • 1
  • 9