Laravel 5.1:file_put_contents() 错误中的 ErrorException,可能是可用磁盘空间不足

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32218398/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 12:15:32  来源:igfitidea点击:

Laravel 5.1: ErrorException in file_put_contents() error,possibly out of free disk space

phplaraveldisklaravel-5.1diskspace

提问by D.P.

This error arrived all out of a sudden.

这个错误是突然出现的。

ErrorException in D:\xampp\htdocs\pckg\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php line 81: file_put_contents(): Only 0 of 3520 bytes written, possibly out of free disk space

D:\xampp\htdocs\pckg\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php 第 81 行中的 ErrorException:file_put_contents():仅写入 3520 个字节中的 0 个,可能磁盘空间不足

回答by D.P.

I just freed / cleared the laravel.logfile in the storage/logsfolder.

我刚刚释放/清除了laravel.log文件storage/logs夹中的文件。

Also clearing cache& sessionsfolders in storage/frameworkfolder can help.

此外清算cachesessions文件夹中的storage/framework文件夹可以帮助。

It just cleared the error and the login page was loaded again !

它只是清除了错误并再次加载了登录页面!

回答by Anmol Shrivastava

The main issue is laravel.log file. For me the file size has grown upto 24G, clearing the file made everything fine.

主要问题是 laravel.log 文件。对我来说,文件大小已经增长到 24G,清除文件后一切正常。

Use command sudo truncate -s 0 <filename>to clear it.

使用命令sudo truncate -s 0 <filename>清除它。

回答by Harshavardhan

This is because your server HDD is full or almost Full.

这是因为您的服务器硬盘已满或几乎已满。

Check by this command

通过这个命令检查

df -h

This will show the stats. figure out where you are storing large chunk of files and delete them.

这将显示统计信息。找出您存储大块文件的位置并删除它们。

clear the following folders in laravel project folder

清除laravel项目文件夹中的以下文件夹

rm -rf storage/framework/cache/
// this will logout presently logged in users
rm -rf storage/framework/sessions/
rm -rf storage/framework/sessions/views/

freeup this file

释放这个文件

> storage/logs/laravel.log

you need to clear the cache by running this command

您需要通过运行此命令来清除缓存

php artisan cache:clear

General / permanent for this is to increase the disk space of the system. or making the cron job to clear the laravel log file at every certain period of time.

通用/永久这个是为了增加系统的磁盘空间。或者让 cron 作业在每个特定时间段清除 laravel 日志文件。

回答by Ayman Elshehawy

Try clearing Composer's cache by running composer clear-cache

尝试通过运行清除 Composer 的缓存 composer clear-cache

回答by Habib Mammadov

I had same issue clearing cache helps

我有同样的问题清除缓存帮助

php artisan cache:clear

回答by Sodruldeen Mustapha

do these to clear cache,views and config

执行这些操作以清除缓存、视图和配置

php artisan cache:clear
php artisan view:clear
php artisan config:clear

回答by Manas

My problem solve by below.

我的问题通过下面解决。

  1. clear all log from storage folder.
  2. Running below artisan command.
  1. 清除存储文件夹中的所有日志。
  2. 在 artisan 命令下运行。
php artisan cache:clear
php artisan view:clear
php artisan config:clear