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

jwharton's avatar

Deploy requires deleting bootstrap/cache/routes.php

We recently upgraded from Laravel 5.5 to 6.2. Thing are fine in my local set up, but whenever we release code we hit a 500 page error after logging in. When I run php artisan config:clear it gives the following error:

Erroneous data format for unserializing 'Symfony\Component\Routing\CompiledRoute'

The only way I have found to fix it is by deleting the bootstrap/cache/routes.php file, and then I can run config:clear and the page loads correctly. I am trying to figure out how to fix this so we don't have to do it after every release. Any ideas? I can probably modify our build spec to include the command to delete it, but I figure there is another reason this is happening and it would be better to fix the root problem. I think it may also be affecting our routes since logging out hits an error page too. None of these issues occur with local envs, just ones we have to deploy to.

Thanks for any direction you can provide!

0 likes
3 replies
Snapey's avatar

is contents of the bootstrap folder part of your deployment?

jwharton's avatar

The contents of bootstrap are not in the deploy. Nginx is running the same version of php as CLI, but I haven't tried downgrading symfony/routing. I might have to try that out and see if it solves it. Thanks for the quick responses.

Please or to participate in this conversation.