Laravel 常见错误

1、2018/05/14 17:59:01 [error] 7932#0: *3 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught UnexpectedValueException: The stream or file "xxx/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in xxx/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107

解决:设置权限

$ chmod -R 777 storage/

 

2、 Laravel/Lumen 出现 "Please provide a valid cache path" 问题

//错误提示: 

InvalidArgumentException in Compiler.php line 36:

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

注意这些目录要有读写权限.

发布了117 篇原创文章 · 获赞 6 · 访问量 1万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章