如何在Google Cloud中访问Laravel文件夹
我的Laravel应用收到错误
I received an error on my Laravel App
/app/storage/logs/laravel-2020-02-20.log"无法打开:无法打开流:权限被拒绝
/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存储
chmod -R 775 storage
chmod -R 775引导程序/缓存
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
找不到目录.
有人可以建议我如何访问存储目录.
Can someone advice me on how to access storage directory.
从标记中,我可以看出它是GCP上的GAE flex.Flex提供了SSH访问权限,但不建议直接在实例上执行读/写操作,因为它们是抢占式的-可以随时通过GCP重新启动.因此,无论何时启动新实例,都必须重复执行您执行的任何命令,这当然会破坏GAE flex上可扩展性的目的.
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.
尝试以下方法:
在项目目录中的composer.json文件中,将以下内容添加到脚本中:
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" ]
有关更多信息,请查看以下社区链接: https://cloud.google.com/community/tutorials/run-laravel-on-appengine-flexible
For more info, check this community link: https://cloud.google.com/community/tutorials/run-laravel-on-appengine-flexible