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

iFelix's avatar

Error clearing cache or routes

Hi all,

I'm running Laravel 5.1 on Heroku.

Heroku installs the app in a temp directory and then copies the temp directory into the app/ directory which means I can't run config:cache in composer's post-install (the path would be wrong).

Unfortunately Heroku does not allow to do cron < 10 minutes which means I can't use Laravel's scheduler.

My solution to cache the routes/config after each deploy was to create a post-deploy hook that sends a GET to myapp.com/postdeploy_hook which runs the following commands :

 \Artisan::call('route:cache');
 \Artisan::call('config:cache');

Unfortunately I get the following error:

Error: unlink(/app/bootstrap/cache/config.php): No such file or directory

Or if I inverse the order:

Error: unlink(/app/bootstrap/cache/routes.php): No such file or directory

Of course Laravel can't clear the cache because it was never created since it's executed right after deploy. But shouldn't it check if the file exists before trying to delete it ?!

Thanks for your help !

Felix

0 likes
1 reply

Please or to participate in this conversation.