What does “write failed: No space left on device” mean?

本小妞迷上赌 提交于 2019-11-27 06:38:16

问题


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

回答1:


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




回答2:


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"




回答3:


df -h

to look /tmp space left.

If /tmp is over 100%

cd /tmp

rm -r ./* -f

And you can save sessions again.



来源:https://stackoverflow.com/questions/5412435/what-does-write-failed-no-space-left-on-device-mean

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!