Laravel 5.1: ErrorException in file_put_contents() error,possibly out of free disk space
Asked Answered
S

8

10

This error arrived all out of a sudden.

ErrorException in D:\xampp\htdocs\pckg\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php line 81: file_put_contents(): Only 0 of 3520 bytes written, possibly out of free disk space

Schaffner answered 26/8, 2015 at 5:8 Comment(5)
check permission of /storage directory and set it to 777Gomuti
Yeah I checked it. That wasn't an issue. Thanks :-)Schaffner
@Schaffner please mention full stack trace in your questionKaminsky
@ARIFMAHMUDRANA - sorry, I don't have it right now .Schaffner
This answer was what I needed: https://mcmap.net/q/1080701/-php-file_put_contents-error (even though your disk isn't full, some disk space might be reserved.)Manson
S
14

I just freed / cleared the laravel.log file in the storage/logs folder.

Also clearing cache& sessions folders in storage/framework folder can help.

It just cleared the error and the login page was loaded again !

Schaffner answered 26/8, 2015 at 10:0 Comment(2)
That seems to be a temporary solutionOzoniferous
How to stop log file creation?Steam
P
6

The main issue is laravel.log file. For me the file size has grown upto 24G, clearing the file made everything fine.

Use command sudo truncate -s 0 <filename> to clear it.

Patristic answered 15/3, 2017 at 15:27 Comment(0)
D
4

This is because your server HDD is full or almost Full.

Check by this command

df -h

This will show the stats. figure out where you are storing large chunk of files and delete them.

clear the following folders in laravel project folder

rm -rf storage/framework/cache/
// this will logout presently logged in users
rm -rf storage/framework/sessions/
rm -rf storage/framework/sessions/views/

freeup this file

> storage/logs/laravel.log

you need to clear the cache by running this command

php artisan cache:clear

General / permanent for this is to increase the disk space of the system. or making the cron job to clear the laravel log file at every certain period of time.

Devoirs answered 2/11, 2018 at 8:6 Comment(2)
this did not work for me... only created more errorsBoatwright
when I removed all of these sessions, it then could not find any so I had to flush all my cache to start from scratch which I think you should add in your answer. If the user does not flush their cache they will get errors can't the laravel app cannot find session variables inside these directories.Boatwright
P
3

Try clearing Composer's cache by running composer clear-cache

Prelude answered 15/4, 2019 at 16:13 Comment(0)
B
1

My problem solve by below.

  1. clear all log from storage folder.
  2. Running below artisan command.
php artisan cache:clear
php artisan view:clear
php artisan config:clear
Benzine answered 4/2, 2020 at 4:14 Comment(0)
C
1

You are getting this error because there is no space on your server. When you will clean server storage it will be fixed.

Consternate answered 15/9, 2020 at 11:38 Comment(1)
This (old) question already contains multiple answers. Can you explain (by editing your answer) where your answer differs from the other answers?Greybeard
F
0

I had same issue clearing cache helps

php artisan cache:clear
Ftc answered 21/6, 2019 at 12:6 Comment(0)
S
0

do these to clear cache,views and config

php artisan cache:clear
php artisan view:clear
php artisan config:clear
Sosthenna answered 2/12, 2019 at 14:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.