I have a project in which DB access is happening during the DI compilation process. My understanding is that there should be no DB access while running bin/magento setup:di:compile. When I test this theory on a default installation of Magento it holds up. No database access during DI compile. (My testing process is to shut down the DB and then run bin/magento setup:di:compile)

I tried removing every custom module from my project, but DB access still happens.

error during DI compile

The progress bar says 100%, but then something at the very end attempts DB access. What could this be?

For reference composer.json. And app/code/ directory is empty.

    "require": {
        "magento/product-community-edition": "2.4.3"
    "require-dev": {
  • The database access credentials are environmental variables and are configured in env.php which can be found under app/etc directory. You can change / remove the access from this file to test.
    – Haijerome
    May 1, 2022 at 0:38
  • Add -vvv to command to get a trace
    – danronmoon
    May 1, 2022 at 14:31
  • Are you using ubuntu? if yes then use super user with sudo. Ex sudo php bin/magento setup:di:compile.
    – S.P
    May 2, 2022 at 5:21

1 Answer 1


You need to start your lampp server

sudo /opt/lampp/lampp start

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.