could not be opened: failed to open stream: Permission denied code example

Example 1: storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

$ chmod -R 775 storage bootstrap/cache

Example 2: could not be opened in append mode: failed to open stream: Permission denied

chmod -R 775 storage
chmod -R 775 bootstrap/cache

Example 3: could not be opened in append mode: failed to open stream: Permission denied

sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache

Example 4: failed to open stream: Permission denied in path on mac

sudo chmod -R 0777 /path

Example 5: laravel.log" could not be opened in append mode

config.vm.synced_folder "./app","/var/www/", create:true,
:owner => "vagrant",
:group => "www-data",
:mount_options => ["dmode=775","fmode=664"]