Reputation: 719
While I work locally, everything works fine. But when I deploy on Google Cloud I have this error
The stream or file "/app/storage/logs/laravel.log" could not be opened: failed to open stream:Permission denied
I have tried to run this from my terminal. I am using window PC and Vscode
chmod -R 775 storage
chmod -R 775 bootstrap/cache
When I run this, it returns
chmod is not recognized as internal or external commands, operable program or batch file.
I also tried this method
"post-install-cmd": [
"chmod -R 775 storage",
"chmod -R 775 bootstrap/cache",
"php artisan optimize:clear"
]
I don't know how to solve this. I need help
Upvotes: 2
Views: 8431
Reputation: 6005
just run this first command
php artisan config:cache
php artisan clear:cache
php artisan route:clear
php artisan view:clear
Upvotes: 1
Reputation: 1325
Google Cloud is a write only filesystem. For directories which need to be written into by the application, you will need to make some modifications.
Please see https://cloud.google.com/community/tutorials/run-laravel-on-appengine-standard and make note of steps 1 and 3 under the deploy section, which set the APP_STORAGE
path to /tmp so that it will be writable.
Upvotes: 1
Reputation: 2069
It's usually because your project folder owner is different than your web server's default owner
I don't know which web server you are using but the common web servers are apache
and nginx
For apache and nginx it's usually is www-data so if you are using apache or nginx
sudo chown -R www-data:www-data /path/to/your/project/folder
otherwise you should figure out what is your web server default ownership is.
Edit:
Please note that giving 777
permission is a bad practice and it cause security issues. there is nothing wrong with default permissions of file and folders of laravel.
Upvotes: 0