My client site suddenly get down today. I tried to running php/magento deploy:mode:set developer. The terminal showing the error: Fatal error: Trait 'Magento\Framework\Interception\Interceptor' not found in generated/code/Magento/Framework/App/Http/Interceptor.php on line 7
I have tried
chmod 777 -R var/* pub/* generated/*
And I also tried rm generated/* but still not working.
Now no matter what command line I ran (eg. bin/magento setup:upgrade; bin/magento deploy:mode:show and so on) , I always get this error.
Anyone can help! Thank you!
Solved! Go to Solution.
Finally fix this issue.
Somehow interceptor.php file is missing in vendor/magento/framework/Interception/
We copied the file from another account and then it's working....
Hello @grace_li
Try this
Set the file permissions correctly: Ensure that the var/, pub/, and generated/ directories have the correct file permissions. Instead of setting the permissions to 777, it's recommended to use more restrictive permissions. You can set the permissions to 755 for directories and 644 for files. Use the following commands to set the permissions:
find var/ pub/ generated/ -type d -exec chmod 755 {} \; find var/ pub/ generated/ -type f -exec chmod 644 {} \;
Remove the generated code: Run the following command to remove the generated code:
rm -rf generated/*
Regenerate the code: Once the generated code is removed, you can regenerate it using the following command:
bin/magento setup:di:compile
This command will recompile the dependency injection configuration and regenerate the necessary code files.
bin/magento cache:flush
Additionally, if you have a separate opcode cache (e.g., APC, OPcache), consider restarting or flushing the opcode cache as well.