0

After running the bin/magento cache:clean the setup gets 500 Error i saw the log means

PHP Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/var/page_cache" is not writable in /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php:209\nStack trace:\n#0 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException()\n#1 /var/www/html/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir()\n#2 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct()\n#3 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend()\n#4 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory()\n#5 /var/www/html/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(38): Magento\Framework\App\Cache\Frontend\Factory->Magento\Framework\App\Cache\Frontend\{closure}()\n#6 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Framework\Cache\Frontend\Adapte in /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php on line 209

After giving the directory access it is showinf the below error

ReflectionException: Class Magento\Framework\App\Http\Interceptor does not exist in /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php:24 Stack trace: #0 /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php(24): ReflectionClass->__construct() #1 /var/www/html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(54): Magento\Framework\Code\Reader\ClassReader->getConstructor() #2 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(48): Magento\Framework\ObjectManager\Definition\Runtime->getParameters() #3 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() #4 /var/www/html/vendor/magento/framework/App/Bootstrap.php(237): Magento\Framework\ObjectManager\ObjectManager->create() #5 /var/www/html/pub/index.php(28): Magento\Framework\App\Bootstrap->createApplication() #6 {main}

After run the setup:di:compile it is working. Iam running the command in as superuser (sudo su), and the file owner is ubuntu is there any problem in the working method. Iam using the magento 2.4.2

1 Answer 1

0

You should not execute any of the magento CLI commands (bin/magento) under root user, instead you should use the same user as the webserver (usually www-data). Otherwise you the webserver will not be able to access the generated resources properly or delete them.

Consider reading https://devdocs.magento.com/guides/v2.4/install-gde/prereq/file-sys-perms-over.html and make sure you apply the directions properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.