Magento – Magento 2.1.2 error 500

errorhttp-error-500magento2PHP

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?

Best Answer

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.

Related Topic