Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lina2023's avatar

Your configuration files are not serializable

I run php artisan config:cache On my terminal I got the message 'configuration cache cleared" but aloso a LogicalExpectation

`Configuration cache cleared!

LogicException

Your configuration files are not serializable.

at C:\xampp\htdocs\Pharmacy-management-system\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▕ }

1 C:\xampp\htdocs\Pharmacy-management-system\bootstrap\cache\config.php:173 Error::("Call to undefined method Closure::__set_state()")

2 C:\xampp\htdocs\Pharmacy-management-system\vendor\laravel\framework\src\Illuminate\Foundation\Console\ConfigCacheCommand.php:67 require()` How to fix this problem , thank you .

0 likes
1 reply
s4muel's avatar

do you have an anonymous function/closure in any of you config file? can you at least identify the part that makes trouble? do so and get rid of the closure and refactor it to use simple serializable values.

or have a look here: https://twitter.com/arukomp/status/1743236477117423781 (but i haven't tried that)

1 like

Please or to participate in this conversation.