Php 我的Laravel应用程序在Google云上有问题。“流或文件”/srv/storage/logs/laravel.log“;无法打开
laravel应用程序在我的本地应用程序中运行良好。 但当我使用命令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
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:* 脚本:自动
您需要按照以下说明中的步骤(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虚拟机,则应该已经设置了这些权限。
可能重复的