cancel
Showing results for 
Search instead for 
Did you mean: 

2.4.5 to 2.4.6 di:compile failure

2.4.5 to 2.4.6 di:compile failure

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. Smiley Happy

 

[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}

8 REPLIES 8

Re: 2.4.5 to 2.4.6 di:compile failure

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:

  • setup
  • lib
  • vendor
  • dev

Afterwards, run your 'composer install' to allow the package manager to download the latest versions of the above mentioned directories.

Re: 2.4.5 to 2.4.6 di:compile failure

@jon_tomsu 

 

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:

  1. 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.

  2. 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.

  3. 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.

  4. Clear Cache: Clear Magento cache before running the compilation again. Sometimes, stale cache files can interfere with the compilation process.

  5. Check System Requirements: Ensure that your server meets the system requirements for running Magento. Check PHP version, required PHP extensions, memory limit, etc.

  6. 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.
Manish Mittal
https://www.manishmittal.com/

Re: 2.4.5 to 2.4.6 di:compile failure

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.

Re: 2.4.5 to 2.4.6 di:compile failure

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

 

  • Update Codebase for Laminas: You need to ensure that all references to Zend are updated to Laminas in your custom code and third-party modules.

 

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;

 

  • Check for Deprecated Code: Check your codebase for any deprecated references or use of old libraries. Replace any Zend references with Laminas.
  • Ensure All Dependencies are Updated: Make sure all your dependencies and third-party modules are updated to their latest versions that are compatible with Magento 2.4.6 and PHP 8.1.

Use the Laminas Migration Tool

 

Magento provides a tool to help migrate from Zend to Laminas. This can automate some of the replacement processes.

 

  • Install the Magento Migration Tool:
    composer require laminas/laminas-zendframework-bridge
  • Run the Migration Tool:
    php vendor/bin/laminas-migration migrate

Additional Tips:

 

  • Check Third-Party Modules: Ensure all third-party modules are compatible with Magento 2.4.6 and have been updated to use Laminas instead of Zend
  • Disable Problematic Modules: If you identify specific modules causing issues, you can temporarily disable them to proceed with the upgrade:

         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. 

Re: 2.4.5 to 2.4.6 di:compile failure

@jon_tomsu 

 

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!

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: 2.4.5 to 2.4.6 di:compile failure

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

Re: 2.4.5 to 2.4.6 di:compile failure

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

Re: 2.4.5 to 2.4.6 di:compile failure

The error you're encountering seems to be caused by a missing dependency (Zend\Mvc\Controller\AbstractActionController) that is not compatible with Magento 2.4.6. To resolve this, try updating your composer dependencies or replacing outdated Zend components. Running composer update or checking for specific Zend versions required by Magento 2.4.6 should help. It's like unlocking unlimited money and tokens in Rally Fury, where fixing the issue gives you a smooth, uninterrupted experiece.