I don't known how it happens this error, maybe after install some module.
Now when I try to save a simple product, I get the next eror:
Class Magento\CatalogRule\Model\Indexer\Product\ProductRuleIndexer\Interceptor does not exist
That's amazing for me !!! How magento can be so weak. What I did to broken interceptor index ? And how I can solve it?
I read in other post that I should change the permissions from three folders, get writing permissions:
chmod -R 777 var/ pub/ generated/
and bin/magento setup:di:compile
but I get an error warning unlink .... and permission denied
The error permission denied is your server related, the user you are using to give permission doesn't have enough access provided to change permission, contact your hosting provider to access or just append sudo in starting before command :
sudo chmod -R 777 var/ generated/ pub/static/ pub/media/
And then after giving permission run indexer command :
php bin/magento indexer:reindex
try the same process again, hope it helps !
kindly check the configured Apache/Nginx user.
you need to change the ownership to that user and after that give 777 permission to var & generated folders.
Step1: Remove generated files and cache
rm -rf var/cache/* generated/code/* var/page_cache/* var/view_preprocessed/*
Step2: Update ownership & permissions
eg. user: www-data
to change the ownership
chown -R www-data generated/ var/ pub/
to give permission
chmod -R 775 generated/ var/
kindly Accept as a Solution if this works for you and give Kudos
@birdawn try changing the ownership and give 775 permission for var & generated folders.
Hi @amitsamsukha Thank you for reply and try to help me with this issue.
As I expect from the beginning solution isn't give more permissions to the files and folders because this increase the vulnerability. set permissions to 777 isn't the solution and can't leave files and folders like this.
In my case Magento can't access to some folders and files because do not had permission, permissions and groups was incorrect, the owner of this files was root, I guess the administrator of hosting did something wrong.
Already I ask for change the permissions to Magento user and everything works.
Thank you very much for reply and try to help me in this issue.
I would like to remark that the solution isn't change the permissions to 777 because this make security vulnerable.
The issue is solved.