After upgrading to magento 2.4.5-p1 and to php 8.1
I get this error while I try to compile
I tried to delete the vendor folder and did composer update but same results.
any way to solve this issue?
public_html$ bin/magento setup:di:compile
Compilation was started.
Repositories code generation... 1/9 [===>------------------------] 11% < 1 sec 115.0 MiBsyntax error, unexpected token "readonly", expecting identifier#0 /home/0.cloudwaysapps.com/bmd/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass()
#1 /home/0.cloudwaysapps.com/bmd/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract()
#2 /home/0.cloudwaysapps.com/bmd/public_html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php(61): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList()
#3 /home/0.cloudwaysapps.com/bmd/public_html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation()
#4 /home/0.cloudwaysapps.com/bmd/public_html/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process()
#5 /home/0.cloudwaysapps.com/bmd/public_html/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute()
#6 /home/0.cloudwaysapps.com/bmd/public_html/vendor/symfony/console/Application.php(1021): Symfony\Component\Console\Command\Command->run()
#7 /home/0.cloudwaysapps.com/bmd/public_html/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand()
#8 /home/0.cloudwaysapps.com/bmd/public_html/vendor/magento/framework/Console/Cli.php(116): Symfony\Component\Console\Application->doRun()
#9 /home/0.cloudwaysapps.com/bmd/public_html/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun()
#10 /home/0.cloudwaysapps.com/bmd/public_html/bin/magento(23): Symfony\Component\Console\Application->run()
#11 {main}
Thanks alot
Kobi
CodePudding user response:
I'm from Cloudways Magento Community
Need to reproduce the steps for resolving the issue:
Downgrade your PHP version and check if its works
It seems some of your extensions create conflict in it, so what you can do is launch another application with the latest version and deploy each of your extensions one by one. This will let you know what causes the conflicts.
Check file permissions: https://support.cloudways.com/en/articles/5126387-how-can-i-reset-file-and-folder-permissions
Check the class which has a readonly keyword because: readonly is a reserved keyword in PHP 8.1. Any existing classes or other symbols that use the name readonly (case insensitive) will result in a syntax error in PHP 8.1.
It is not possible to port the readonly functionality to older PHP versions. However, the @readonly / @property-read annotations is understood by static analyzers such as Psalm.
Thanks