【发布时间】:2019-07-10 06:26:04
【问题描述】:
为什么会出现这个错误?
file_put_contents():仅写入 178 个字节中的 0 个,可能磁盘空间不足
*
* @param string $path
* @return string
*/
public function hash($path)
{
return md5_file($path);
}
/**
* Write the contents of a file.
*
* @param string $path
* @param string $contents
* @param bool $lock
* @return int
*/
public function put($path, $contents, $lock = false)
{
return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
}
/**
* Prepend to a file.
*
* @param string $path
* @param string $data
* @return int
*/
public function prepend($path, $data)
{
if ($this->exists($path)) {
return $this->put($path, $data.$this->get($path));
}
return $this->put($path, $data);
}
/**
* Append to a file.
【问题讨论】:
-
我的第一个猜测是您的服务器正在运行/已用完存储空间。
storage/logs中有多少个日志文件(大约)? -
有一个日志文件 7.82 mb
-
您的服务器上还有很多其他网站吗?
-
总共有很多站点
-
首先要检查网站的所有日志文件,看看是否有占用大量空间的文件。如果没有,那么您将不得不增加服务器的存储空间,迁移到更大的服务器和/或查看解决方案来托管占用相当多空间的东西(即图像,视频、用户上传等),例如 aws。