$dirsToCreate = [ base_path('storage'), base_path('storage/framework'), base_path('storage/framework/views'), base_path('storage/framework/sessions'), base_path('storage/framework/cache'), base_path('storage/framework/cache/data'), base_path('storage/framework/testing'), base_path('storage/app'), base_path('storage/app/public'), ]; foreach ($dirsToCreate as $dir) { if (is_dir($dir)) { continue; } mkdir($dir, 0777, true); }