0

I'm currently developing a Magento 2 site, but I'm having quite a lot of issues with permissions/ownership.

I'm running Magento on a VPS, and I have followed Magentos official documentation for multiple users, not shared hosting.

Currently, I have these users:

  • root (Web server root)
  • user (part of the sudoers file)
  • Magento (Magento filesystem user - Is there any way I can double check/change this?) Also part of www-data group
  • sftp (My SFTP, locked into /var/www/html)

When I try and upgrade from 2.1.2 to 2.1.3, I get the error :

Fatal error: Interface 'Psr\Log\LoggerInterface' not found in /var/www/html/magento/update/vendor/monolog/monolog/src/Monolog/Logger.php on line 27

The file in that directory is there, with 775 permissions for magento:www-data. I have tried user:www-data, magento:www-data .. etc.

My Cron job also fails, it only works via CLI if I append sudo before the commend - I believe this is permissions related too. This fails with the error:

Command line user does not have read and write permissions on var/generation directory. Please address this issue before using Magento command line." - This has 775 permissions, recursive through the /var/ dir.

I'm using:

  • Ubuntu 14.04.1 LTS x64
  • PHP 7.0.11-1
  • MySQL 5.6.33
  • Apache/2.4.7

Aside from chmod 777, I don't know what else to do. I believe that my Magento 2 isn't using the Magento user - how can I check?

Thanks for your time

2
  • What web server are you using? Dec 21, 2016 at 17:02
  • @AndréFerraz I'm using Apache/2.4.7, apologies for missing that out Dec 21, 2016 at 17:18

1 Answer 1

3

Try fix permissons by commands below

sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && sudo chown -R $USER:www-data . && sudo chmod u+x bin/magento
sudo find var pub/media pub/static -type d -exec chmod g+ws {} \;
sudo find var pub/media pub/static -type f -not -name .htaccess -exec chmod g+w {} \;
sudo find -L vendor/bin -type f -exec chmod u+x {} \;
2
  • Unfortunately I'm still having the same issue after running those commands. The file is definitely in the directory, even with 777 permissions owned by magento:www-data or user:www-data I still have the problem - I don't understand Dec 22, 2016 at 20:09
  • This fixed my problem
    – Ravi Soni
    May 9, 2018 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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