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

Mubeenali's avatar

The bootstrap/cache directory must be present and writable on shared hosting laravel

Hi i manually install a package in my live site and after i removed all the files manually.Now when i try to access my website any route or anything this is showing me this message

"The bootstrap/cache directory must be present and writable" i tried the following commands on my live server

  //Clear Cache facade value:
Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    return '<h1>Cache facade value cleared</h1>';
});

//Reoptimized class loader:
Route::get('/optimize', function() {
    $exitCode = Artisan::call('optimize');
    return '<h1>Reoptimized class loader</h1>';
});

//Route cache:
Route::get('/route-cache', function() {
    $exitCode = Artisan::call('route:cache');
    return '<h1>Routes cached</h1>';
});

//Clear Route cache:
Route::get('/route-clear', function() {
    $exitCode = Artisan::call('route:clear');
    return '<h1>Route cache cleared</h1>';
});

//Clear View cache:
Route::get('/view-clear', function() {
    $exitCode = Artisan::call('view:clear');
    return '<h1>View cache cleared</h1>';
});

//Clear Config cache:
Route::get('/config-cache', function() {
    $exitCode = Artisan::call('config:cache');
    return '<h1>Clear Config cleared</h1>';
});

But it is showing me the same message even if i try to run the above commands ..Please help me what can i do now i am so upset Please help me ...

0 likes
2 replies
Talinon's avatar

Sounds like you manually deleted the bootstrap/cache directory? Just re-create it and the artisan commands should stop throwing that error. Run from your project root: mkdir bootstrap/cache and make sure the permissions are set properly.

1 like
Solvando's avatar

Thanks! It also works for me after I searching an hour for this crazy error that came from the unknown.

Please or to participate in this conversation.