I'm running into the below. This is part of my suffering 2.3.5 to 2.4.6 journey.
Any insight would be greatly appreciated as I'm down in production at the moment.
[server_admin]:public_html$ bin/magento setup:di:compile
Compilation was started.
Application code generator... 3/9 [=========>------------------] 33% 6 secs 248.0 MiB
There is an error in /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/setup/src/Magento/Setup/Controller/LandingUpdater.php at line: 14
Class "Zend\Mvc\Controller\AbstractActionController" not found#0 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/vendor/composer/ClassLoader.php(576): include()
#1 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}()
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#3 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(134): class_exists()
#4 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass()
#5 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract()
#6 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ApplicationCodeGenerator.php(100): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList()
#7 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ApplicationCodeGenerator.php(69): Magento\Setup\Module\Di\App\Task\Operation\ApplicationCodeGenerator->getFiles()
#8 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\ApplicationCodeGenerator->doOperation()
#9 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process()
#10 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/vendor/symfony/console/Command/Command.php(298): Magento\Setup\Console\Command\DiCompileCommand->execute()
#11 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#12 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#13 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/vendor/magento/framework/Console/Cli.php(116): Symfony\Component\Console\Application->doRun()
#14 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/vendor/symfony/console/Application.php(171): Magento\Framework\Console\Cli->doRun()
#15 /home/408275.cloudwaysapps.com/cwsqfdragk/public_html/bin/magento(23): Symfony\Component\Console\Application->run()
#16 {main}
It appears that the error occurs in:
setup/src/Magento/Setup/Controller/LandingUpdater.php
The above class was probably missed by composer as part of your upgrade process, to force composer to pull down the latest version of this class, try removing the setup directory from the Magento root and then executing "composer install" again.
You may also want to consider removing the following directories from the Magento root directory:
Afterwards, run your 'composer install' to allow the package manager to download the latest versions of the above mentioned directories.
It seems like your compilation process has encountered an error. Without the specific error message, it's challenging to pinpoint the exact issue. However, here are some general steps you can take to troubleshoot and resolve the problem:
Check Error Message: Look for the error message that follows the line "There is an error in" in your console output. This error message will provide more information about what went wrong during the compilation process.
Review Code Changes: If you've recently made any changes to your Magento codebase, review those changes to see if there are any syntax errors or issues that could be causing the compilation error.
Check File Permissions: Ensure that the files and directories in your Magento installation have the correct permissions. Improper file permissions can sometimes cause issues during the compilation process.
Clear Cache: Clear Magento cache before running the compilation again. Sometimes, stale cache files can interfere with the compilation process.
Check System Requirements: Ensure that your server meets the system requirements for running Magento. Check PHP version, required PHP extensions, memory limit, etc.
Disable Compilation Mode: If you're unable to resolve the issue, you can temporarily disable the compilation mode by running the following command:
bin/magento setup:di:compile --no-compile
This will skip the compilation process and allow you to access your store. However, it's important to resolve the underlying issue and re-enable compilation mode for optimal performance.
Once you have more information about the specific error message, you'll be better equipped to troubleshoot and resolve the compilation issue.
Same issue, then I create a new magento2 in another path and found that the path "setup" in new installation do not have those files.
So rm -r setup, and copy paste. and it works.
This is simply a result of magento not removing outdated files.
Hi @jon_tomsu,
The error message indicates that the Magento setup process is trying to use a class from the Zend\Mvc\Controller namespace, which is not found. This is likely because the Zend Framework was deprecated and removed in Magento 2.4.x in favor of Laminas. The migration from Magento 2.3.x to 2.4.x requires updating the code to be compatible with Laminas.
Steps to Resolve the Issue
You need to update all instances of Zend to Laminas. For instance, in the file LandingUpdater.php:
Use: Laminas\Mvc\Controller\AbstractActionController;
Instead of: use Zend\Mvc\Controller\AbstractActionController;
Use the Laminas Migration Tool
Magento provides a tool to help migrate from Zend to Laminas. This can automate some of the replacement processes.
Additional Tips:
php bin/magento module:disable Vendor_ModuleName
Error Logs: Always check Magento logs in var/log/ for more detailed error messages which might provide further insights.
By following these steps, you should be able to resolve the issue related to the deprecated Zend framework and complete your upgrade process.
If the issue will be resolved, Click Kudos & Accept as a Solution.
Hey,
Search in app or vendor folder, from which module this class is used using this command:
grep -rnw app/ -e "AbstractActionController"
then replace it with : Laminas\Mvc\Controller\AbstractActionController;
Thank You!
Run composer update for ensuring that all dependencies are correctly installed. IF you want to download these before installtion, use a safe browsing app, named as vidmate apk
After removing setup folder and then running composer:install new setup folder doesn't get generated again! So I guess this is not the correct solution