[Solved] file_put_contents(/bootstrap/cache/packages.php): failed to open stream: Permission denied
If you did some composer update sometimes you can get error like this:
Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover
In Filesystem.php line 122:
file_put_contents(/bootstrap/cache/packages.php): failed to open stream: Permission denied
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1
To solve this issue run commands
sudo chmod -R o+w bootstrap/cache/
sudo chmod -R o+w storage/