Php 我的Laravel应用程序在Google云上有问题。“流或文件”/srv/storage/logs/laravel.log“;无法打开

Php 我的Laravel应用程序在Google云上有问题。“流或文件”/srv/storage/logs/laravel.log“;无法打开,php,laravel,google-cloud-platform,gcloud,Php,Laravel,Google Cloud Platform,Gcloud,laravel应用程序在我的本地应用程序中运行良好。 但当我使用命令gcloud-App-deploy将其上传到谷歌应用程序引擎时。然后它给我写日志的错误 UnexpectedValueException The stream or file "/srv/storage/logs/laravel.log" could not be opened: failed to open stream: Read-only file system 代码是my laravel应用程序根文件夹中的app.ya

laravel应用程序在我的本地应用程序中运行良好。 但当我使用命令
gcloud-App-deploy
将其上传到谷歌应用程序引擎时。然后它给我写日志的错误

UnexpectedValueException
The stream or file "/srv/storage/logs/laravel.log" could not be opened: failed to open stream: Read-only file system
代码是my laravel应用程序根文件夹中的app.yaml文件

版权所有2015谷歌公司。保留所有权利。 运行时间:php72

api_版本:1 线程安全:正确 运行时配置: 文档根:public

处理程序: -url:/favicon.ico 静态文件:public/favicon.ico 上传:public/favicon.ico

  • url:* 脚本:自动
环境变量: #取消注释以下内容以启用调试模式

应用程序调试:0 应用程序日志:错误日志 应用程序密钥:base64:nzd12xL4YtD3fIKYYRc/NGIfA+phk39fGJrvq11UBug= 应用程序日志级别:调试 存储目录:/tmp

DB\u主机:“” DB\u用户名:“” DB_密码:“” DB_数据库:“”

缓存驱动程序:memcache 会话驱动程序:memcache 邮件驱动程序:“邮件” 日志驱动程序:“系统日志”

存储路径:“gs://#默认值#/laravel/STORAGE”


您需要按照以下说明中的步骤(1)和(3)重写Laravel存储物品的位置:

简略地-

步骤1,在app.yaml中,您需要添加:

APP_STORAGE: /tmp
然后在第三步中,你让拉威尔使用这个。通过在return语句之前添加以下代码块来修改bootstrap/app.php。这将允许您将存储路径设置为/tmp,以便在生产中进行缓存

# [START] Add the following block to `bootstrap/app.php`
/*
|--------------------------------------------------------------------------
| Set Storage Path
|--------------------------------------------------------------------------
|
| This script allows you to override the default storage location used by
| the  application.  You may set the APP_STORAGE environment variable
| in your .env file,  if not set the default location will be used
|
*/
$app->useStoragePath(env('APP_STORAGE', base_path() . '/storage'));
# [END]

安装Laravel后,您可能需要配置一些权限。存储和引导/缓存目录中的目录应由web服务器写入,否则Laravel将无法运行。如果您正在使用Homestead虚拟机,则应该已经设置了这些权限。
可能重复的