0

Having problem getting

/var/www/html# bin/magento setup:di:compile

Compilation was started. Application code generator... 3/8 [==========>-----------------] 37% 4 secs 252.0 MiB In PhpScanner.php line 183:

Class \DbClass does not exist

ReflectionException: Class Magento\Framework\App\Http\Interceptor does not exist in /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php

I have follow all instruction on various website Nothing seems to be working?

asked Feb 3 at 19:40

2 Answers 2

0

First, debug your instance by disabling all third-party modules.

You can do this by running the following command:

php bin/magento module:disable <Selected Third-Party Modules> 

Next, run the compilation process again to check if it succeeds. If the compilation is successful, enable each module one by one and check which one causes the compilation to fail. This will help you identify the problematic module and apply the fix OR contact the support team if it is by another vendor.

rm -rf var/cache/* var/page_cache/* pub/static/* generated/* && php bin/magento setup:upgrade && php bin/magento setup:di:compile
answered Feb 4 at 11:26
0

Possible Causes & Solutions

1. Check for Missing or Incorrect Namespace

If \DbClass is being referenced in your code but does not exist, Magento will fail during compilation.

Solution:

  1. Locate the incorrect reference:

    grep -r "DbClass" app/code/

  2. If you find:

    use DbClass;

    Change it to:

    use Vendor\Module\Model\DbClass;

  3. Ensure that DbClass.php exists in the correct app/code/Vendor/Module/Model/ directory.

2. Remove Generated Classes & Regenerate Sometimes, outdated or corrupted generated files cause issues.

Solution: Run the following commands to clear generated classes and recompile:

rm -rf generated/metadata/*
rm -rf generated/code/*
php bin/magento setup:di:compile

3. Check Interceptor Class Issue

The error about:

Class Magento\Framework\App\Http\Interceptor does not exist
indicates a missing generated class.

Solution: Recreate the missing interceptor classes by running:

rm -rf var/cache/* var/page_cache/* generated/*
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

4. Verify Your Module Structure If you are working on a custom module, ensure:

  • The registration.php file exists in app/code/Vendor/Module/
  • The module.xml file exists in app/code/Vendor/Module/etc/
  • The correct namespace is used in your classes.

5. Disable Problematic Modules If the issue started after installing an extension, try disabling it:

php bin/magento module:disable Vendor_ModuleName
php bin/magento cache:flush
php bin/magento setup:di:compile

Then, check if compilation completes.

6. Verify Composer Dependencies If you recently upgraded Magento or added a module, check for missing dependencies:

composer install
composer dump-autoload

Then, retry:

php bin/magento setup:di:compile
answered Feb 10 at 6:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.