Magento 2 : Error 500 after installing





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















[Ubuntu 18.04 / Apache 2.4 / PHP 7.2.17 / Magento 2.3.1]



After successful installing, magento show blank page. I found following error in apache error.log:




[php7:error] [pid 29252] [client 127.0.0.1:45454] PHP Fatal error:
Uncaught RuntimeException: Can't create directory
/var/www/html/magento/generated/code/Magento/Framework/App/ResourceConnection/.nClass
MagentoFrameworkAppResourceConnectionProxy 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. in
/var/www/html/magento/vendor/magento/framework/Code/Generator.php:135nStack
trace:n#0
/var/www/html/magento/vendor/magento/framework/Code/Generator/Autoloader.php(35):
MagentoFrameworkCodeGenerator->generateClass('Magento\Framewo...')n#1
[internal function]:
MagentoFrameworkCodeGeneratorAutoloader->load('Magento\Framewo...')n#2
[internal function]: spl_autoload_call('Magento\Framewo...')n#3
/var/www/html/magento/vendor/mag in
/var/www/html/magento/vendor/magento/framework/Code/Generator.php on
line 135




I have set chmod -R 777 /var/www/html/magento/generated.
But it's showing the same error.
Can you help?










share|improve this question









New contributor




mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    2















    [Ubuntu 18.04 / Apache 2.4 / PHP 7.2.17 / Magento 2.3.1]



    After successful installing, magento show blank page. I found following error in apache error.log:




    [php7:error] [pid 29252] [client 127.0.0.1:45454] PHP Fatal error:
    Uncaught RuntimeException: Can't create directory
    /var/www/html/magento/generated/code/Magento/Framework/App/ResourceConnection/.nClass
    MagentoFrameworkAppResourceConnectionProxy 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. in
    /var/www/html/magento/vendor/magento/framework/Code/Generator.php:135nStack
    trace:n#0
    /var/www/html/magento/vendor/magento/framework/Code/Generator/Autoloader.php(35):
    MagentoFrameworkCodeGenerator->generateClass('Magento\Framewo...')n#1
    [internal function]:
    MagentoFrameworkCodeGeneratorAutoloader->load('Magento\Framewo...')n#2
    [internal function]: spl_autoload_call('Magento\Framewo...')n#3
    /var/www/html/magento/vendor/mag in
    /var/www/html/magento/vendor/magento/framework/Code/Generator.php on
    line 135




    I have set chmod -R 777 /var/www/html/magento/generated.
    But it's showing the same error.
    Can you help?










    share|improve this question









    New contributor




    mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      2












      2








      2


      1






      [Ubuntu 18.04 / Apache 2.4 / PHP 7.2.17 / Magento 2.3.1]



      After successful installing, magento show blank page. I found following error in apache error.log:




      [php7:error] [pid 29252] [client 127.0.0.1:45454] PHP Fatal error:
      Uncaught RuntimeException: Can't create directory
      /var/www/html/magento/generated/code/Magento/Framework/App/ResourceConnection/.nClass
      MagentoFrameworkAppResourceConnectionProxy 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. in
      /var/www/html/magento/vendor/magento/framework/Code/Generator.php:135nStack
      trace:n#0
      /var/www/html/magento/vendor/magento/framework/Code/Generator/Autoloader.php(35):
      MagentoFrameworkCodeGenerator->generateClass('Magento\Framewo...')n#1
      [internal function]:
      MagentoFrameworkCodeGeneratorAutoloader->load('Magento\Framewo...')n#2
      [internal function]: spl_autoload_call('Magento\Framewo...')n#3
      /var/www/html/magento/vendor/mag in
      /var/www/html/magento/vendor/magento/framework/Code/Generator.php on
      line 135




      I have set chmod -R 777 /var/www/html/magento/generated.
      But it's showing the same error.
      Can you help?










      share|improve this question









      New contributor




      mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      [Ubuntu 18.04 / Apache 2.4 / PHP 7.2.17 / Magento 2.3.1]



      After successful installing, magento show blank page. I found following error in apache error.log:




      [php7:error] [pid 29252] [client 127.0.0.1:45454] PHP Fatal error:
      Uncaught RuntimeException: Can't create directory
      /var/www/html/magento/generated/code/Magento/Framework/App/ResourceConnection/.nClass
      MagentoFrameworkAppResourceConnectionProxy 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. in
      /var/www/html/magento/vendor/magento/framework/Code/Generator.php:135nStack
      trace:n#0
      /var/www/html/magento/vendor/magento/framework/Code/Generator/Autoloader.php(35):
      MagentoFrameworkCodeGenerator->generateClass('Magento\Framewo...')n#1
      [internal function]:
      MagentoFrameworkCodeGeneratorAutoloader->load('Magento\Framewo...')n#2
      [internal function]: spl_autoload_call('Magento\Framewo...')n#3
      /var/www/html/magento/vendor/mag in
      /var/www/html/magento/vendor/magento/framework/Code/Generator.php on
      line 135




      I have set chmod -R 777 /var/www/html/magento/generated.
      But it's showing the same error.
      Can you help?







      magento2 permissions file-permissions magento2.3.1






      share|improve this question









      New contributor




      mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited yesterday









      Vivek Kumar

      2,6392730




      2,6392730






      New contributor




      mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked yesterday









      mashuxamashuxa

      132




      132




      New contributor




      mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      mashuxa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You have to give permissions to var pub and generated directories. cd into your magento installation and run following command;



          chmod -R 777 var pub generated


          you may also need to run setup upgarade and deploy static files so run following commands too ;



          php bin/magento s:up && php bin/magento s:s:d -f && chmod 777 -R  var pub generated





          share|improve this answer
























          • Thank you very much. But now I have new error: There has been an error processing your request /var/www/html/magento/var/report {"0":"SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'","1":"<pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:406]n#2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]n#3 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at...

            – mashuxa
            yesterday













          • you may not have connected to your db correctly. Enter your db user credentials and correct db in {magento_root}/app/etc/env.php

            – Vivek Kumar
            yesterday













          • Also please accept the answer if it helped

            – Vivek Kumar
            yesterday











          • Thank you very much. It works. Also problem was related with root user's password. I created new user with strong password and magento started!

            – mashuxa
            yesterday












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          mashuxa is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270020%2fmagento-2-error-500-after-installing%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You have to give permissions to var pub and generated directories. cd into your magento installation and run following command;



          chmod -R 777 var pub generated


          you may also need to run setup upgarade and deploy static files so run following commands too ;



          php bin/magento s:up && php bin/magento s:s:d -f && chmod 777 -R  var pub generated





          share|improve this answer
























          • Thank you very much. But now I have new error: There has been an error processing your request /var/www/html/magento/var/report {"0":"SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'","1":"<pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:406]n#2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]n#3 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at...

            – mashuxa
            yesterday













          • you may not have connected to your db correctly. Enter your db user credentials and correct db in {magento_root}/app/etc/env.php

            – Vivek Kumar
            yesterday













          • Also please accept the answer if it helped

            – Vivek Kumar
            yesterday











          • Thank you very much. It works. Also problem was related with root user's password. I created new user with strong password and magento started!

            – mashuxa
            yesterday
















          1














          You have to give permissions to var pub and generated directories. cd into your magento installation and run following command;



          chmod -R 777 var pub generated


          you may also need to run setup upgarade and deploy static files so run following commands too ;



          php bin/magento s:up && php bin/magento s:s:d -f && chmod 777 -R  var pub generated





          share|improve this answer
























          • Thank you very much. But now I have new error: There has been an error processing your request /var/www/html/magento/var/report {"0":"SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'","1":"<pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:406]n#2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]n#3 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at...

            – mashuxa
            yesterday













          • you may not have connected to your db correctly. Enter your db user credentials and correct db in {magento_root}/app/etc/env.php

            – Vivek Kumar
            yesterday













          • Also please accept the answer if it helped

            – Vivek Kumar
            yesterday











          • Thank you very much. It works. Also problem was related with root user's password. I created new user with strong password and magento started!

            – mashuxa
            yesterday














          1












          1








          1







          You have to give permissions to var pub and generated directories. cd into your magento installation and run following command;



          chmod -R 777 var pub generated


          you may also need to run setup upgarade and deploy static files so run following commands too ;



          php bin/magento s:up && php bin/magento s:s:d -f && chmod 777 -R  var pub generated





          share|improve this answer













          You have to give permissions to var pub and generated directories. cd into your magento installation and run following command;



          chmod -R 777 var pub generated


          you may also need to run setup upgarade and deploy static files so run following commands too ;



          php bin/magento s:up && php bin/magento s:s:d -f && chmod 777 -R  var pub generated






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          Vivek KumarVivek Kumar

          2,6392730




          2,6392730













          • Thank you very much. But now I have new error: There has been an error processing your request /var/www/html/magento/var/report {"0":"SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'","1":"<pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:406]n#2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]n#3 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at...

            – mashuxa
            yesterday













          • you may not have connected to your db correctly. Enter your db user credentials and correct db in {magento_root}/app/etc/env.php

            – Vivek Kumar
            yesterday













          • Also please accept the answer if it helped

            – Vivek Kumar
            yesterday











          • Thank you very much. It works. Also problem was related with root user's password. I created new user with strong password and magento started!

            – mashuxa
            yesterday



















          • Thank you very much. But now I have new error: There has been an error processing your request /var/www/html/magento/var/report {"0":"SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'","1":"<pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:406]n#2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]n#3 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at...

            – mashuxa
            yesterday













          • you may not have connected to your db correctly. Enter your db user credentials and correct db in {magento_root}/app/etc/env.php

            – Vivek Kumar
            yesterday













          • Also please accept the answer if it helped

            – Vivek Kumar
            yesterday











          • Thank you very much. It works. Also problem was related with root user's password. I created new user with strong password and magento started!

            – mashuxa
            yesterday

















          Thank you very much. But now I have new error: There has been an error processing your request /var/www/html/magento/var/report {"0":"SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'","1":"<pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:406]n#2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]n#3 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at...

          – mashuxa
          yesterday







          Thank you very much. But now I have new error: There has been an error processing your request /var/www/html/magento/var/report {"0":"SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'","1":"<pre>#1 Zend_Db_Adapter_Pdo_Mysql->_connect() called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:406]n#2 Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() called at [vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:460]n#3 Zend_Db_Adapter_Abstract->query('SELECT `store_we...', array()) called at...

          – mashuxa
          yesterday















          you may not have connected to your db correctly. Enter your db user credentials and correct db in {magento_root}/app/etc/env.php

          – Vivek Kumar
          yesterday







          you may not have connected to your db correctly. Enter your db user credentials and correct db in {magento_root}/app/etc/env.php

          – Vivek Kumar
          yesterday















          Also please accept the answer if it helped

          – Vivek Kumar
          yesterday





          Also please accept the answer if it helped

          – Vivek Kumar
          yesterday













          Thank you very much. It works. Also problem was related with root user's password. I created new user with strong password and magento started!

          – mashuxa
          yesterday





          Thank you very much. It works. Also problem was related with root user's password. I created new user with strong password and magento started!

          – mashuxa
          yesterday










          mashuxa is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          mashuxa is a new contributor. Be nice, and check out our Code of Conduct.













          mashuxa is a new contributor. Be nice, and check out our Code of Conduct.












          mashuxa is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270020%2fmagento-2-error-500-after-installing%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          數位音樂下載

          When can things happen in Etherscan, such as the picture below?

          格利澤436b