0

Summary (*)

Magento 2, Version 2.2.8 started throwing 500 error after update.

Examples (*)

Error logs

Class Magento\Framework\App\Http\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. {"exception":"[object] (RuntimeException(code: 0): The specified \"/home/.../public_html/generated/code/Magento/Framework/App/Http/Interceptor.php.27337\" file could not be written Warning!file_put_contents(/home/.../public_html/generated/code/Magento/Framework/App/Http/Interceptor.php.27337): failed to open stream: Permission denied
Class Magento\\Framework\\App\\Http\\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. at /home/.../public_html/vendor/magento/framework/Code/Generator.php:135)"} []

Proposed solution

Ran the following commands, compile and cleared cache.

 chmod -R 0777 generated

 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

 rm -rf pub/static/*

 rm -rf var/cache var/generation var/page_cache

 find ./pub/media/catalog -type f -exec chmod 777 {} \;
3
  • run upgrade, then redeploy static contents, then apply chmod then check it should work
    – fmsthird
    Commented Apr 2, 2019 at 4:44
  • Have you checked the permission for generated folder? Please share the screenshot in your Magento root folder by running ll command Commented Apr 2, 2019 at 5:31
  • Thanks for the assistance. Mitrajsinh vaghela's first Solution solved the problem.
    – P. Paul
    Commented Apr 3, 2019 at 3:20

2 Answers 2

0

Perform This Command In DataBase :-

UPDATE core_config_data SET value = 'Your/Site/Url' WHERE config_id = '5';

UPDATE core_config_data SET value = 'Your/Site/Url' WHERE config_id = '6';   

Please Follow This Step:-

sudo rm -rf pub/static/frontend/ pub/static/adminhtml/ pub/static/_requirejs pub/static/deployed_version.txt var/cache var/page_cache var/generation var/view_preprocessed var/session generated/code

sudo php bin/magento setup:upgrade

sudo php bin/magento setup:static-content:deploy en_US -f

sudo php bin/magento cache:flush

sudo chmod -R 777 generated/ var/ pub/ app/
5
  • Thanks for the support. However, applying those commands didn't sold the problem. Still getting 500 error. Screenshot here: prntscr.com/n6744r
    – P. Paul
    Commented Apr 2, 2019 at 3:51
  • check base url in core_config_data table Commented Apr 2, 2019 at 6:02
  • Hi @Mitrajsinh I just checked the core_config_data table and it looked really weird to me because I couldn't see the site's URL. Here's the screenshot: prntscr.com/n6hepw
    – P. Paul
    Commented Apr 2, 2019 at 15:45
  • check updated answer
    – user68317
    Commented Apr 2, 2019 at 16:23
  • Thanks Mitrajsinh vaghela! Your first Solution solved the problem.
    – P. Paul
    Commented Apr 3, 2019 at 3:21
0

First of all enable error log & uncomment this below line from the file app/bootstrap.php error_reporting(E_ALL);
ini_set('display_errors', 1);

Apply r/w permission as per Magento Docs.

After check error it might be possible from third party extension are giving error.

1
  • Thanks for the assistance. Mitrajsinh vaghela's first Solution solved the problem.
    – P. Paul
    Commented Apr 3, 2019 at 3:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.