0

I'm just starting the experience of Magento 2.1.2 but I'm having trouble : I can't acces to Magento directory due of an error 500. I've put the directory in chmod 775 but my NGINX log say :

2016/10/16 12:56:18 [error] 31168#31168: *512 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Magento\Framework\Exception\FileSystemException: The file "/var/www/magento/var/.regenerate" cannot be deleted Warning!unlink(/var/www/magento/var/.regenerate): Permission denied in /var/www/magento/vendor/magento/framework/Filesystem/Driver/File.php:382

So it's seems to be a permission issue. Anyone get an idea?

2

As you already noted, this is a permissions problem. Try the recommended approach to setting permissions, maybe you made some kind of mistake which excluded some files from receiving the appropriate write permissions.

First navigate to your Magento directory on your server:

cd /var/www/magento

Afterwards, try setting the permissions via this command:

find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+w {} \; && chmod u+x bin/magento

If that does not work, go use cd /var/www/magento/var/ and type ls -al to see if the permissions on all files are properly set so that your web server can write / delete all files.

  • Also check ownership, which should be nginx:<magento file system owner> – Steve Johnson Oct 17 '16 at 14:58
1

Try this:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento cache:flush
chmod -R 777 pub var app/etc
  • this worked for me: chmod -R 777 pub var app/etc.....BUT.....is that safe for a production enivonment?? – styzzz Jul 28 '17 at 3:34

protected by Community Oct 17 '16 at 9:28

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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