Reputation: 427
Running the command: php artisan route:cache
produces the following execption:
Erroneous data format for unserializing 'Symfony\Component\Routing\CompiledRoute'
Running: php artisan route:clear
fixes it
I'd like to know how I can fix this so I can cache my routes.
Upvotes: 17
Views: 10464
Reputation: 3490
For me, this error was solved by deleting the following path files:
\bootstrap\cache
Upvotes: 11
Reputation: 427
After a bunch of figuring things out. I found that Apache2 was still using an older version of PHP even though the CLI version was up to date.
After uninstalling all older versions of php and reconfiguring Apache2 to use the latest version fixed this issue.
Upvotes: 3
Reputation: 841
I hope you are using same php version for CLI and also for the project . Also PHP 7.4 routing cache doesn't work with php 7.3 .
Upvotes: 6
Reputation: 24
When trying to update Laravel, the same problem arose. The only way that helped me was to downgrade the version of symfony/routing to v4.2.0 (I had v 4.4.3)
composer require symfony/routing:v4.2.0
Upvotes: 0
Reputation: 151
This worked for me
php artisan optimize:clear
php artisan config:clear
php artisan config:cache
composer dump-autoload
Upvotes: 12