0

In an existing Magento 2.4.3 instance, I changed its database and connected with another 2.4.3 DB, different extensions and theme. New Magento had been working, but after changing back to the old database again, it is not working. Though I've removed the extensions and themes to match the old environment. Now, I get the following error:

Warning: file_exists(): open_basedir restriction in effect. File(/Controller) is not within the allowed path(s): (/var/www/clients/client1/web37/web) in /var/www/clients/client1/web37/web/vendor/magento/framework/Module/Dir/Reader.php on line 153 {"report_id":"aac604f62e1917f96bd5b93452d01fb0f8cae049593174b88604da61486b2efa","exception":"[object] (Exception(code: 0): Warning: file_exists(): open_basedir restriction in effect. File(/Controller) is not within the allowed path(s): (/var/www/clients/client1/web37/web) in /var/www/clients/client1/web37/web/vendor/magento/framework/Module/Dir/Reader.php on line 153 at /var/www/clients/client1/web37/web/vendor/magento/framework/App/ErrorHandler.php:61)"} []

Can anyone get this kind of error? How can I fix it quickly?

1 Answer 1

0

When I searched on Google with this error message, most answers suggested changing the PHP open_basedir setting. However, adjusting the open_basedir setting did not resolve this error.

To troubleshoot it, I set a breakpoint on line 153 of vendor/magento/framework/Module/Dir/Reader.php and added a line to identify which extension was causing the error:

echo $moduleName;

By this, I was able to identify the problematic extension. I disabled the extension to stop the error message.

Sometimes, this error can occur due to incomplete compilation. In such cases, you can try running the setup upgrade command:

bin/magento setup:upgrade
rm -rf var/di generated/*
bin/magento setup:di:compile

rm -rf pub/static/*/*; rm -rf var/*/*;
bin/magento setup:static-content:deploy -f
bin/magento cache:flush

Hopefully, this answer can save you time when troubleshooting a similar error.

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.