Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP file_put_contents() error

Tags:

php

Everytime I try to modify a file, I get this error and I don't know what it means:

A PHP Error was encountered

Severity: Warning

Message: file_put_contents() [function.file-put-contents]: Only 0 of 19463 bytes written, possibly out of free disk space

Filename: Template/String.php

Line Number: 369

I tried looking for solutions and so far none of them made sense, well, in my opinion.

Any thoughts? A little help here please. Thank you very much.

like image 320
rightsound Avatar asked Nov 07 '10 14:11

rightsound


2 Answers

This is an old question but it comes up when Googling for the error message. Here is another possible cause for this error message.

The ext2/3/4 filesystems can reserve disk space for root. Often it is 5% of the drive. df shows the drive is not entirely used. Root can write to the drive. Non-root users will only be able to create files but not write any data to them. See dumpe2fs and tune2fs for more details.

like image 145
Chad Clark Avatar answered Sep 16 '22 17:09

Chad Clark


This probably means that PHP is able to get a valid file descriptor, but is hitting a wall (such as a quota, sticky bit, etc) when actually trying to write the data.

It is also conceivable that you are writing (perhaps unwittingly) to a network file system that is having a problem with its peer.

More information regarding your platform would help (I've seen SELinux do strange things when improperly configured), but I think you get the gist of what to check.

like image 35
Tim Post Avatar answered Sep 19 '22 17:09

Tim Post