0

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?

asked Apr 9, 2019 at 13:31

1 Answer 1

0

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
answered Apr 9, 2019 at 13:34
1

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.