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

ncltours's avatar

file_put_contents(): Only 0 of 178 bytes written, possibly out of free disk space

file_put_contents(): Only 0 of 178 bytes written, possibly out of free disk space

Can you help me solve this problem please?

0 likes
6 replies
lostdreamer_nl's avatar

We'll need to know more:

  1. What is the path you're trying to write to
  2. How much disk space is left on that partition / mount point
  3. What OS are you using
  4. Perhaps some code around this file_put_contents (what is being saved?)

It could be:

  1. Out of disk space (as the error states)
  2. Almost out of disk space (< 5% left, only root user may write those on EXT filesystems)
  3. Permissions on the file / folder you try to write to
  4. File locking is used to lock this file before you try to write to it
1 like
ncltours's avatar

I am using AWS Ubuntu server. Surprisingly my laravel.log file is missing. My server is apache2 server. when I run command: $du -sh *

My list of files with diskspace is: My Lib folder is 18 G which is very large.

Other files are in MB

Do I need to delete some files inside Lib folder which is basically my system files? If yes what files should I delete?

lostdreamer_nl's avatar

Try the command

df -h

To see how much free space you have left for each mount point and make sure there is enough space left in the mount point you are currently writing to.

DO NOT DELETE STUFF FROM lib FOLDER or you might trash your server.

ncltours's avatar

I just restarted my mysql server from the console and it automatically decreased the size to some 400M .. Now It works fine. Thanks

lostdreamer_nl's avatar

sounds like your mysql server has some terrible logging/dump settings.

It might be a good time to check those out before the server has been running so long that it starts crashing again.

ncltours's avatar

yeah.. You are absolutely right. Thanks

Please or to participate in this conversation.