Php 应用程序引擎标准上的Laravel:/srv/bootstrap/cache目录必须存在且可写
我已经在谷歌应用引擎标准环境中挣扎了一天了 错误如下: PHP注意事项:异常情况:/srv/bootstrap/cache目录必须为 呈现并可写。在里面 /srv/vendor/laravel/framework/src/illusted/Foundation/PackageManifest.php:168 我知道Php 应用程序引擎标准上的Laravel:/srv/bootstrap/cache目录必须存在且可写,php,laravel,google-app-engine,google-app-engine-php,Php,Laravel,Google App Engine,Google App Engine Php,我已经在谷歌应用引擎标准环境中挣扎了一天了 错误如下: PHP注意事项:异常情况:/srv/bootstrap/cache目录必须为 呈现并可写。在里面 /srv/vendor/laravel/framework/src/illusted/Foundation/PackageManifest.php:168 我知道/tmp文件夹是App Engine标准环境中唯一可写的文件夹。因此,myapp.yaml具有以下附加的env_变量: APP_STORAGE: "/tmp" VIEW_COM
/tmp
文件夹是App Engine标准环境中唯一可写的文件夹。因此,myapp.yaml
具有以下附加的env_变量
:
APP_STORAGE: "/tmp"
VIEW_COMPILED_PATH: "/tmp"
…mybootstrap/app.php
包含以下行:
$app->useStoragePath(env('APP_STORAGE', base_path() . '/tmp'));
…我的composer.json
有以下脚本来解释配置的更改:
"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
中配置的驱动程序:
SESSION_DRIVER: database
BROADCAST_DRIVER: log
CACHE_DRIVER: database
QUEUE_DRIVER: sync
出于某种原因,我似乎找不到一种方法使/tmp
文件夹成为放置缓存视图和配置的文件夹。实际上,我怀疑..:clear
命令根本没有正确运行
无论路径如何,我的应用程序现在只是一个空白的白页。这是公平的,因为存在不可写入的缓存,因此无法在那里渲染和存储视图
以上配置应与在Google App Engine Standard上安装Laraval的教程相匹配,例如以下教程:
在云控制台中,我检查了/tmp
文件夹是否存在,情况就是这样
无论如何,我们非常感谢所有的帮助。如果您需要更多的代码片段,请询问。我很乐意提供它们。我找到了解决这个问题的简单方法。Laravel应用程序所在的谷歌应用程序引擎标准目录是只读的。因此,您必须将缓存文件写入
/tmp
您只需将此环境变量添加到您的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
这是否与以下事实有关:在illumb\Foundation\Application.php中,路径在正常执行时是从$this->bootstrapPath()解析的(它返回一个绝对路径),但在运行测试时似乎是从APP\u CONFIG\u CACHE变量和其他变量解析的
/**
* Get the path to the configuration cache file.
*
* @return string
*/
public function getCachedConfigPath()
{
return Env::get('APP_CONFIG_CACHE', $this->bootstrapPath().'/cache/config.php');
}
Replacing it like this seems to do the job on my side.
/**
* Get the path to the cached services.php file.
*
* @return string
*/
public function getCachedServicesPath()
{
return $this->basePath(Env::get('APP_SERVICES_CACHE', 'bootstrap/cache/services.php'));
}
/**
* Get the path to the cached packages.php file.
*
* @return string
*/
public function getCachedPackagesPath()
{
return $this->basePath(Env::get('APP_PACKAGES_CACHE', 'bootstrap/cache/packages.php'));
}
/**
* Get the path to the configuration cache file.
*
* @return string
*/
public function getCachedConfigPath()
{
return $this->basePath(Env::get('APP_CONFIG_CACHE', 'bootstrap/cache/config.php'));
}
/**
* Get the path to the routes cache file.
*
* @return string
*/
public function getCachedRoutesPath()
{
return $this->basePath(Env::get('APP_ROUTES_CACHE', 'bootstrap/cache/routes.php'));
}
/**
* Get the path to the events cache file.
*
* @return string
*/
public function getCachedEventsPath()
{
return $this->basePath(Env::get('APP_EVENTS_CACHE', 'bootstrap/cache/events.php'));
}
然后
准许
sudo chmod -R 775 bootstrap/cache/
运行bellow命令
php artisan config:cache
在部署之前,请尝试:
php artisan route:clear
php artisan view:clear
php artisan config:clear
php artisan cache:clear
php artisan optimize:clear
对我来说,这是
optimize:clear
你的app.yaml
和bootstrap/app.php
看起来不错。
但你还需要做一件事:
如果您使用的是Laravel 6或更高版本,请删除facade/ignition
dependency:
composer remove --dev facade/ignition
或如果您使用的是Laravel 5或更早版本,请删除
beyondcode/Laravel转储服务器
:
composer remove --dev beyondcode/laravel-dump-server
这就是你提到的社区医生对此的看法: 这是对一个错误的修复,该错误是由于Laravel在bootstrap/cache/services.php中缓存导致的
这并不能回答有关谷歌云应用程序引擎的问题。您不能从该服务中运行这两个命令。能否转到写入方法中的
/srv/vendor/laravel/framework/src/illighte/Foundation/PackageManifest.php
文件中的第168行并转储$this->manifestPath
属性?