Failed to open stream: Permission denied in code example

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

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

Example 2: failed to open stream permission denied laravel

chmod -R 777 storage/

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

sudo chmod -R 0777 /path

Example 4: failed to open stream permission denied in php

$ sudo chmod -R 0755 /var/www/html/mysite/images/

$ sudo chmod -R 0755 /var/www/html/mysite/tmp_file_upload/