如何在Google Cloud中访问Laravel文件夹 [英] How to access Laravel Folder in Google Cloud

查看:54
本文介绍了如何在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

这篇关于如何在Google Cloud中访问Laravel文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆