App Engine Standard上的Laravel:/srv/bootstrap/cache目录必须存在且可写 [英] Laravel on App Engine Standard: The /srv/bootstrap/cache directory must be present and writable

查看:117
本文介绍了App Engine Standard上的Laravel:/srv/bootstrap/cache目录必须存在且可写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Google App Engine标准环境中挣扎了一天.

I've been struggling with the Google App Engine Standard environment for a day now.

错误如下:

PHP注意:例外:/srv/bootstrap/cache目录必须为 目前且可写.在 /srv/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php:168

PHP Notice: Exception: The /srv/bootstrap/cache directory must be present and writable. in /srv/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php:168

我知道/tmp文件夹是App Engine标准环境的唯一可写文件夹.因此,我的app.yaml具有以下其他env_variables:

I know that the /tmp folder is the only writable folder for the App Engine Standard environment. Therefore, my app.yaml have the following additional env_variables:

  APP_STORAGE: "/tmp"
  VIEW_COMPILED_PATH: "/tmp"

...我的bootstrap/app.php包含以下行:

...my bootstrap/app.php contains this line:

$app->useStoragePath(env('APP_STORAGE', base_path() . '/tmp'));

...并且我的composer.json使用以下脚本来说明配置的更改:

...and my composer.json has these scripts to account for the change in configuration:

        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump"
        ],
        "post-install-cmd": [
            "composer dump-autoload",
            "php artisan config:clear",
            "php artisan cache:clear",
            "php artisan view:clear",
            "php artisan cache:clear",
            "php artisan regenerate:schoolCSS"
        ]

这些是我在app.yaml中配置的驱动程序:

These are my drivers configured in app.yaml:

SESSION_DRIVER: database
BROADCAST_DRIVER: log
CACHE_DRIVER: database
QUEUE_DRIVER: sync

由于某种原因,我似乎似乎无法找到一种方法来将/tmp文件夹设置为放置缓存的视图和配置的文件夹.实际上,我怀疑...:clear命令根本没有正确运行.

For some reason, I just can't seem to find a way to make the /tmp folder the folder where the cached views and config are put. Actually, I suspect that the ...:clear commands aren't even properly ran at all.

无论路径如何,我的应用程序现在只是一张白纸.这是公平的,因为由于缓存不可写,因此无法在其中呈现和存储视图.

My application is just a blank white page now, regardless of the path. That's fair, as due to the unwritable cache, the views cannot be rendered and stored there.

以上配置应与在Google App Engine标准上安装Laraval的教程相匹配,例如以下内容:

The above configurations should match the tutorials for installing Laraval on Google App Engine Standard, such as this one: https://cloud.google.com/community/tutorials/run-laravel-on-appengine-standard.

在云控制台中,我检查了是否存在/tmp文件夹.

In the cloud console, I've checked whether the /tmp folder exists, which is the case.

无论如何,我们非常感谢所有帮助.如果您需要更多代码段,请询问.我很乐意提供它们.

Anyways, all help is dearly appreciated. If you need more code snippets, just ask. I'll be happy to provide them.

推荐答案

我找到了解决此问题的简单方法. Laravel应用程序在Google App Engine Standard上的驻留目录是只读的.因此,您必须将缓存文件写入/tmp.

I found a simple solution for this problem. The directory where the Laravel application lives on Google App Engine Standard is read-only. So you have to write the cache files to /tmp.

您可以通过简单地将此环境变量添加到您的app.yaml

You can change the paths by simple adding this environment variables to your app.yaml

APP_SERVICES_CACHE: /tmp/services.php
APP_PACKAGES_CACHE: /tmp/packages.php
APP_CONFIG_CACHE: /tmp/config.php
APP_ROUTES_CACHE: /tmp/routes.php

这篇关于App Engine Standard上的Laravel:/srv/bootstrap/cache目录必须存在且可写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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