PHP artisan config:cache 报错问题

vagrant@homestead:~/code/larabbs$ php artisan config:cache
Configuration cache cleared!

   LogicException  : Your configuration files are not serializable.

  at /home/vagrant/code/larabbs/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php:71
    67|             require $configPath;
    68|         } catch (Throwable $e) {
    69|             $this->files->delete($configPath);
    70| 
  > 71|             throw new LogicException('Your configuration files are not serializable.', 0, $e);
    72|         }
    73| 
    74|         $this->info('Configuration cached successfully!');
    75|     }

  Exception trace:

  1   Error::("Call to undefined method Closure::__set_state()")
      /home/vagrant/code/larabbs/bootstrap/cache/config.php:29

  2   require()
      /home/vagrant/code/larabbs/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php:67

  Please use the argument -v to see more details.
vagrant@homestead:~/code/larabbs$ cd bootstrap/cache/
vagrant@homestead:~/code/larabbs/bootstrap/cache$ ls
packages.php  services.php
vagrant@homestead:~/code/larabbs/bootstrap/cache$ 

根据站内的教程,获取最近活跃用户使用缓存redis,替换后无效,依然是文件缓存。

  1   Error::("Call to undefined method Closure::__set_state()")
      /home/vagrant/code/larabbs/bootstrap/cache/config.php:29

这个文件目录里面没有
现在怀疑是这个NFS Plugin的问题。
解决 Windows 系统使用 Homestead 运行 Laravel 本地项目响应缓慢问题

请各位指教一二~

ShiKi
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
最佳答案

首先,你是开发环境,不建议使用这个命令.其次你是在homestead中报的这个错,没必要去debug.homestead中的错.环境引发的问题,让大牛也会很头疼.最后,要是有条件的话,建议还是买个macbook来开发.

4年前 评论
讨论数量: 5

看报错中提示是 config 配置格式错误,不能正确序列化

4年前 评论

首先,你是开发环境,不建议使用这个命令.其次你是在homestead中报的这个错,没必要去debug.homestead中的错.环境引发的问题,让大牛也会很头疼.最后,要是有条件的话,建议还是买个macbook来开发.

4年前 评论

问题来了,在 MacBook 下也出现这样的错误:

file

4年前 评论

配置中有匿名函数。原因:laravel 缓存配置调用 serialize 函数序列化配置文件,匿名函数序列化为 Closure::setstate(),反序列化后为一个函数体为空的名为setstate 的函数,这个函数没定义,报出错误。

4年前 评论
cc1997

我也遇到这个问题,不过我看到抛出的异常是bootstrap/cache/config.php这个文件,而我在bootstrap/cache/没有,然后又重新传了下就可以了执行php php artisan config:cache。。。 不过运行不起网页了,删除config.php这个就可了,但是又不能执行命令了。。。恼火

2年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!