Permissions Problems

I am having issues with permissions on my webserver (Ubuntu 20.04, Nginx 1.18, PHP 8.0) I ran these commands to set permissions for everything in the website directory:

sudo chown -R $USER:www-data .

sudo find . -type f -exec chmod 664 {} \;
sudo find . -type d -exec chmod 775 {} \;

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

It seemed to work for a while but now I can't run composer update with out getting this error:

Script Statamic\Console\Composer\Scripts::preUpdateCmd handling the pre-update-cmd event terminated with an exception


  [ErrorException]
  copy(./storage/statamic/updater/composer.lock.bak): Failed to open stream: Permission denied

And I can't run any php please or php artisan commands. Example when I ran php please cache:clear I get this error:

Failed to clear cache. Make sure you have the appropriate permissions.

The weird thing is, I first pulled my Git repo to the server I was able to run composer, npm, and artisan commands with no issue. But the next day I was getting weird caching issues so I tried to clear the cache and nothing worked anymore.

Does anyone have any ideas?

>>>>>>> Unanswered <<<<<<<
0 Replies
1 Follower