Magento 2.4.2-p1
Smartwave Porto theme
extensions from Amasty
We have the Smartwave Porto theme. It came with Mageplaza Layered Navigation but an old version. Since we have some problems that I raised with Smartwave Porto, they suggested I would upgrade to the latest Mageplaza Layered Navigation version = layered-navigation_v4.1.1_m2_ce_mageplaza.
I have done that, and when running the following command afterwards:
php bin/magento setup:di:compile
I get this Error:
The directory "/home/myaccount/public_html/generated/code/Magento" cannot be deleted Warning!rmdir(/home/myaccount/public_html/generated/code/Magento): Directory not empty
I asked Mageplaza and said the following:
...please run the command again with adding "sudo" at first.
So I've tried the following:
sudo php bin/magento setup:di:compile
and my Putty says the following:
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
and asked for the password again. Once I entered the password - it gave the following Error:
myaccount is not in the sudoers file. This incident will be reported.
When googling this topic, I found the following article:
Here it says:
www-data must be owner of the project if using Apache as web-server. Please execute commands given below:
sudo chown -R www-data:www-data [path to magento directory]
navigate to root of your magento project
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chmod u+x bin/magento
We had a problem with ownership/permissions before. Is it safe for me run these in Putty via SSH on the account itself and/or ask our hosting company to do it for me?