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

alihuseyin's avatar

file_put_contents(C:\xampp\htdocs\xxx\storage\framework/sessions/KXcxw0bXfbUEyvf2fCN12hiHt9VFeWTFFEzS42rk): failed to open stream: No such file or directory

I upload my laravel to shared hosting but it's path for storage is C:\xampp... (local)

How can I change it? or do I have a choise to not using session option?

0 likes
34 replies
shez1983's avatar

have you hardcoded the paths somewhere? usually laravel should just use correct values..

alihuseyin's avatar

@shez1983 not really, now I am trying to re upload all files and folders to shared hosting, let's see If it will be fixed

bashy's avatar

You should re-create the cache for composer/autoload/paths. The paths get cached so if you upload everything it will use your local path, not the server's.

alihuseyin's avatar

@bashy sorry I am new to laravel and it was working fine yesterday, can you give me an example?

bashy's avatar
  • composer dump-autoload
  • composer install
  • php artisan cache:clear
  • php artisan clear-compiled

Can't really say without knowing where it stored that path.

4 likes
Neeraj1005's avatar

sometimes if this condition is not working. just check is sessions directory availablele inside the storage/framework/sessions

1 like
steveleblanc's avatar

I deleted the file /public_html/bootstrap/cache/config.php

then I ran php artisan config:cache

This worked for me

10 likes
virtue's avatar

You can as well rename your config.php to config.php.old and refresh your application or else open your application incognito (ctrl + Shift + N ). This worked for me

JemCdo's avatar

php artisan config:clear

php artisan cache:clear

worked for me

5 likes
sevenTopo's avatar

Ok i don't have any terminal or git in server ,can i make this modifications in my local then try to upload it if it's yes plz how can i do it.

Isavic's avatar

This is just want you need to do:

Navigate to your projects /bootstrap/cache/ folder.

then delete the contents of the directory and everything will work

2 likes
abdullahalharun's avatar

Add the following code in your routes/web.php

Route::get('/clear', function() {

Artisan::call('cache:clear');
Artisan::call('config:cache');
Artisan::call('view:clear');
return "Cleared!";

});

Then go to your site/clear

Hope, It may help.

2 likes
Nihir's avatar

I Get same issue and found automatic created folder in my public_html the folder name is like D:\xampp\htdocs\c....\ it cant be deleted and modified and for this folder I get an error this one "file_put_contents(D:\xampp\htdocs\csidBackUp\storage\framework/sessions/ixHLlCSBvfeUi7b9op4AWQrlf1SG82xzOBCMmLq3): Failed to open stream: No such file or directory " now what do I do? any suggestion

Ahtnezev's avatar

@Nihir Como mencionaron arriba, tienes que ejecutar los siguientes comandos:

php artisan view:clear cache:clear config:clear

o ejecutar todas con: php artisan optimize

Nadjat's avatar

It worked for me when i changed all paths in C:\xampp\htdocs...\bootstrap\cache\config.php

Snapey's avatar

@Nadjat Just run php artisan config:cache You don't want to be editing a cache file directly.

2 likes
Gfinity's avatar

@Nadjat Hello please how did you rename the path and what should I rename it to?

skwnapp.com's avatar

Just now I just discovered a step that works out.

Try this: Open your web files, then public_html/storage/framework/.... (in this directory create a new folder as "sessions" then refresh your website. It should load fine

If not laravel for others check the core folder then storage/framework/.... (in this directory create a new folder as "sessions" then refresh your website.

prabba90's avatar

In my case, I did the following:

create these folders under storage/framework: sessions, views, cache then works fine.

Bashir313's avatar

After changing my config.php to config_old.php, I am seeing another error:

Class "App\Models\portfolio" not found (View: /home4/jambgigs/myunique.ozmadugu.com/resources/views/frontend/home_all/portfolio_page_all.blade.php)

Snapey's avatar

Well done, you win today's archaeologist prize for digging up the oldest question.

Now start your own question because this is not even closely related

1 like
Naman178's avatar

This is just want you need to do:

Navigate to your projects /bootstrap/cache/ folder.

then delete the contents of the directory and everything will work

this is also works for me

Please or to participate in this conversation.