How to access Laravel Folder in Google Cloud

与世无争的帅哥 提交于 2021-01-29 10:28:37

问题


I received an error on my Laravel App

/app/storage/logs/laravel-2020-02-20.log" could not be opened: failed to open stream: Permission denied

So I google the error, and I discovered it a permission error.

chmod -R 775 storage

chmod -R 775 bootstrap/cache

Apparently, this fixes the error, but anytime I tried to run the command in the cloud console. It keeps saying

No directory found.

Can someone advice me on how to access storage directory.


回答1:


From the tags, I can tell it is GAE flex on GCP. Flex gives you SSH access, but it is not advisable to execute read/write operations directly on the Instances as they are preemptive - can be restarted anytime by GCP. So any command you execute will have to be repeated whenever a new instance starts, which will of course defeats the purpose of scalability on GAE flex.

Try this instead:

On the composer.json file in your project directory, add the follow to the scripts:

        "post-install-cmd": [
       "Illuminate\\Foundation\\ComposerScripts::postInstall",
       "@php artisan optimize",
       "chmod -R 755 storage bootstrap\/cache" ]

For more info, check this community link: https://cloud.google.com/community/tutorials/run-laravel-on-appengine-flexible



来源:https://stackoverflow.com/questions/60331089/how-to-access-laravel-folder-in-google-cloud

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!