解决 Laravel/Lumen 出现 "Please provide a valid cache path" 问题
新建项目报错:
//错误提示:
InvalidArgumentException in Compiler.php line 36:
Please provide a valid cache path.
错误提示的出错:
// vendor/illuminate/view/Compilers/Compiler.php
if (! $cachePath) {
throw new InvalidArgumentException('Please provide a valid cache path.');
}
这个路径是在 config/cache.php 中指定的,可以自行修改成其他地址:
// cache 配置文件示例
return [
// ...
'stores' => [
// ...
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache'), //缓存地址
],
],
// ...
]
创建目录:
✗ mkdir -p storage/framework/views
✗ mkdir -p storage/framework/cache
✗ mkdir -p storage/framework/sessions
确保 storage 目录结构如下:
./storage
├── app
├── framework
│ ├── cache
│ ├── sessions
│ └── views
└── logs
└── lumen.log
注意这些目录要有读写权限.