26

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
Carl0s1z
  • 4,683
  • 7
  • 32
  • 47
Michael
  • 525
  • 2
  • 6
  • 6
  • 3
    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. – Charles Mar 23 '11 at 22:32

5 Answers5

16

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

nicolaas
  • 1,783
  • 1
  • 17
  • 24
  • @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). – Czechnology Mar 23 '11 at 22:33
  • 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. – Michael Mar 23 '11 at 22:38
  • 2
    It's not only the files you upload there, for example very large log-files may cause the problem. – Dr.Molle Mar 23 '11 at 22:43
  • 1
    `/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. – Marc B Mar 24 '11 at 00:54
  • 1
    why does this answer accepted? or "call your hoster" is an universal answer to any web sh*t happened? – Tertium Nov 03 '16 at 19:05
  • 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. – Laurence Cope Apr 11 '17 at 16:16
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"

Greg
  • 23,155
  • 11
  • 57
  • 79
Fernando
  • 1,126
  • 12
  • 13
3

df -h

to look /tmp space left.

If /tmp is over 100%

cd /tmp

rm -r ./* -f

And you can save sessions again.

Community
  • 1
  • 1
Angelinux
  • 144
  • 4
  • 9
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.

javier_domenech
  • 5,995
  • 6
  • 37
  • 59
0

try use this command on console:

php bin/console cache:clear