0

Previous version Magento 2.4.5 and php 7.4

After upgrade php version 8.1 getting compile error < 1 sec 117.0 MiBsyntax error, unexpected token "<"#0 /var/www/html/magento/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass() #1 /var/www/html/magento/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract() #2 /var/www/html/magento/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php(61): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList() #3 /var/www/html/magento/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation() #4 /var/www/html/magento/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process()

After debug the code in /var/www/html/magento/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php file its getting error related with private function. private function includeClass(string $className, string $fileItemPath): bool { if (!class_exists($className)) { // phpcs:ignore require_once $fileItemPath; return true; } return false; }

So I remove the function and write the code directly called function. But I have seen same error is getting at compile time which define at private function. private function extract(\RecursiveIteratorIterator $recursiveIterator)

After that didnt get any solution then downgrade the PHP version 8.1 to 7.4. But this time again getting following error. PHP Fatal error: Uncaught Error: Call to undefined function Symfony\Component\Console\mb_detect_encoding() in /usr/share/php/Symfony/Component/Console/Application.php:1146 Stack trace: #0 /usr/share/php/Symfony/Component/Console/Application.php(806): Symfony\Component\Console\Application->splitStringByWidth() #1 /usr/share/php/Symfony/Component/Console/Application.php(776): Symfony\Component\Console\Application->doRenderException() #2 /usr/share/php/Symfony/Component/Console/Application.php(132): Symfony\Component\Console\Application->renderException() #3 /usr/share/php/Symfony/Component/Console/Application.php(155): Symfony\Component\Console\Application->Symfony\Component\Console{closure}() #4 /usr/share/php/Composer/Console/Application.php(113): Symfony\Component\Console\Application->run() #5 /usr/bin/composer(62): Composer\Console\Application->run() #6 {main} thrown in /usr/share/php/Symfony/Component/Console/Application.php on line 1146

1 Answer 1

0

it seems to be related to a missing PHP extension. The "mbstring" extension is not enabled in your PHP 7.4 installation.

You can enable this extension by adding this line to your php.ini file

extension=mbstring.so
2
  • If we will proceed with PHP version 8.1 then how to resolve the issue ?
    – A.Roy
    Commented Mar 9, 2023 at 4:44
  • You can do it in this same way for php 8.1 also . I mean just enable the extension
    – Harun
    Commented Mar 9, 2023 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.