Domanda

I've recently setup and installed Magento 2, but am having issues adding products to the site. when I click to add a product I get the following exception error:

Exception #0 (RuntimeException): Can't create directory /var/www/html/gdprmk.co.uk/generated/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice/. Class Magento\Catalog\Model\Product\Attribute\Backend\Tierprice\Interceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only.

I tried to manually create the Tierprice folder with 755 permissions but then I get the following error message:

Exception #0 (RuntimeException): The specified "/var/www/html/gdprmk.co.uk/generated/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice/Interceptor.php.9261" file couldn't be written. Warning!file_put_contents(/var/www/html/gdprmk.co.uk/generated/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice/Interceptor.php.9261): failed to open stream: Permission denied Class Magento\Catalog\Model\Product\Attribute\Backend\Tierprice\Interceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate

The folder had 755 permissions if that helps! Does anyone know how to solve this issue?

È stato utile?

Soluzione

You don't have write access for generated directory

Execute this as a root user

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
sudo chown -R :<web server group> .
chmod u+x bin/magento
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top