Error after magento upgrade
I have solved this problem by just simply doing this steps. follow steps :
- Delete the "di" folder located in
var
directory (for2.0
and2.1
) Run this command and go to your project root folder command:
cd /yourmagentoroot/
If your Magento mode is developer then you don't need to run below commands just remove
var/generation
directory(2.0 & 2.1) orgenerated
folder(2.2 onwards)Then run this command
php bin/magento setup:di:compile
Then run this command (required in production mode only)
php bin/magento setup:static-content:deploy
Finally, give file/directory permissions.(If needed)
Giving full control (read/write/execute) to var and pub directory solved this issue for me.
sudo chmod -R 777 var pub
Or, you may also try running the command using sudo.
sudo php bin/magento setup:upgrade
Also, try clearing cache.
sudo rm -rf var/cache/* var/generation/*
Setup ownership again
CentOS: chown -R :apache .
Ubuntu: chown -R :www-data .
Refer this Link