Martin Yakimov
Martin Yakimov

Reputation: 33

Laravel file_put_contents error on shared hosting

I created my Laravel app and I am uploading on shared hosting. It's show error:

file_put_contents(D:\xampp\htdocs\Laravel\storage\framework/sessions/FlEPsHNW7Rggfb9wvDZ71K7D2YQNNQK0epRBRQnW): failed to open stream: No such file or directory

This is folder from my computer. I read same problems but I am on shared hosting and I don't have a composer or artisan for operations.

Thanks in advance!

Upvotes: 2

Views: 16329

Answers (5)

Md Monirul Islam
Md Monirul Islam

Reputation: 21

Just delete the entire file from the bootstrap/cache folder.

In my case its working fine.

Upvotes: 0

Artem Tischenko
Artem Tischenko

Reputation: 1

cleared the cache for me

php artisan cache:clear

Upvotes: 0

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111829

What you should do is looking for occurrences of xampp in your application because it seems you have sessions that are written to same folder that you have on your machine and obviously such directory doesn't exist on web server.

Especially make sure you in session.php you have:

'files' => storage_path('framework/sessions'),

and remove config cache from bootstrap/cache directory just in case

Upvotes: 9

ceexon
ceexon

Reputation: 835

I had the same issue here. I tried to run php artisan config:cache but it didn't work out

Then I delete all my sessions in /myprojectname/storage/framework/ but still didn't work out on shared hosting but worked fine on localhost.

Here's what worked:

I delete the cache folder in /myprojectname/bootstrap/ and ran the application and got this error:

Exception thrown with message "The /hosthome/hostuser/myprojectname/bootstrap/cache directory must be present and writable."

I then made a new cache folder in /myprojectname/bootstrap/ and ran the site and it was up

in short terms

  • Navigate to your projects /bootstrap/cache/ folder.

  • Delete the contents of the directory and your good to go 😀

Upvotes: 5

San K
San K

Reputation: 223

Change config path and make sure storage folder has correct permission Directory Permissions

After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.

Upvotes: 0

Related Questions