What does "write failed: No space left on device" mean?
Asked Answered
D

5

28

I am getting these errors on my site, yet i haven't changed any code or anything, so I don't why this is happening.

Warning: Unknown(): write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). 
Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
Drus answered 23/3, 2011 at 22:27 Comment(1)
I've retitled and retagged your question -- the error is coming from PHP, not MySQL. Be glad for that, you totally don't want to deal with MySQL after an out of space condition.Betel
A
17

I'm assuming you're hosting your site on a shared hosting provider Basicly the error means that the server has run out of disk space, so it can't complete the sql commands

Just call/email the hosting company and they should fix it for you

Anastasio answered 23/3, 2011 at 22:28 Comment(7)
@Michael, ..unless you've went over your own space limit - in that case you'll have to fix it yourself (free up some space in the db).Aerometry
I really don't use alot of space, so I doubt the problem is caused by me, I'll send a mail to the hosting company about it. Thank you.Drus
It's not only the files you upload there, for example very large log-files may cause the problem.Dynameter
/tmp may be a completely seperate file system and have run out of space, even if the rest of the web tree has plenty of space left.Blameworthy
why does this answer accepted? or "call your hoster" is an universal answer to any web sh*t happened?Adamo
this cannot be the only answer because this just happened to me and I have 18Gb left on the main disk and enough space on other partitions. I cant explain it at the moment.Lanellelanette
just clearing the cache resolved my issues symfony: php bin/console cache:clear and Laravel see this post or delete the content of the var directory.Purple
L
7

In a shared hosting, change the location where sessions are saved.

Create the directory: /public_htm/tmp, give the permissions (777) <- then you have to tune it (for security).

Create a file .htaccess in the directory /public_htm/tmp with:

order deny, allow
deny from all
allow from 127.0.0.1

And in your PHP script, on top (in your front controller):

session_save_path(dirname($_SERVER['DOCUMENT_ROOT']).'/public_html/tmp');

Important: You must be added before session_start()

Check this with a script:

<?php
session_save_path(dirname($_SERVER['DOCUMENT_ROOT']).'/public_html/tmp');
session_start();
$_SESSION['Text'] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis nunc eu ut elit eget adipiscing facilisis turpis."
phpinfo();
?>

Check if changed the directive "session.save_path"

Lu answered 31/5, 2012 at 13:59 Comment(0)
C
3

df -h

to look /tmp space left.

If /tmp is over 100%

cd /tmp

rm -r ./* -f

And you can save sessions again.

Clayberg answered 7/3, 2015 at 16:16 Comment(0)
M
1

If you have partitions (df -h) and the one you're hosting the mysql is full.

Move the folders that are more size consuming to the new partition, in my case mv /var/mail /home, and create a symink sudo ln -s /home/mail mail. You can move mysql itself.

Monarchism answered 19/5, 2020 at 12:22 Comment(0)
P
0

try use this command on console:

php bin/console cache:clear

Putumayo answered 10/10, 2022 at 14:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.