homestead - fwrite() : write of XX bytes failed with errno=5 Input/output error

标签 homestead nfs vagrant-windows

我之前有 2 个类似的问题,但是经过更多的调试后,我得出的结论是问题(可能)不在我自己的代码中。
在我的代码中,我试图解压缩一个 gzipped 文件,为此我编写了一个小方法;

<?php

namespace App\Helpers;

class Gzip
{

    public static function unzip($filePath)
    {
        $outFilePath = str_replace('.gz', '', $filePath);

        // Open our files (in binary mode)
        $file = gzopen($filePath, 'rb');
        $outFile = fopen($outFilePath, 'wb');

        // Keep repeating until the end of the input file
        while (!gzeof($file)) {
            // Read buffer-size bytes
            // Both fwrite and gzread and binary-safe
            fwrite($outFile, gzread($file, 4096));
        }

        // Files are done, close files
        fclose($outFile);
        gzclose($file);
    }
}
这应该会导致解压文件;
Gzip::unzip('path/to/file.csv.gz');
这就是它变得棘手的地方,有时它会解压缩文件,有时它会抛出这个异常; (请记住,这与 StreamHandler 本身无关,这是一个纯输入/输出错误问题)
exception fwrite
我可以根据需要多次刷新页面,但如果我尝试使用 gunzip,则不会有任何改变。命令行上的命令它将失败并排序相同的错误;
gunzip error
  • 我解压缩哪个文件并不重要,它随机发生在一个随机文件上。

  • 现在我是否运行 gunzip 也无关紧要命令多次,但就像我说的,这些异常/错误是随机发生的,所以它们也会随机“修复”它们。
    该应用程序是用 Laravel 8.0 编写的,PHP7.4 在 Homestead 环境(Ubuntu 18.04.5 LTS)上运行,我的基本笔记本电脑在 Windows 10 上运行。
    对我来说,这个异常/错误是随机发生的,而且也是随机的“修复”本身,这是非常奇怪的,所以我的问题是:这是怎么发生的,为什么会发生这种情况,最终我该如何修复它。

    最佳答案

    errno=5 Input/output error是读/写Linux文件系统失败。
    真正的服务器,需要用fsck等检查磁盘...
    Homestead 在 Windows 上运行,我认为我们应该寻找 windows 10 homestead errno -5问题。
    winnfsd - https://github.com/winnfsd/vagrant-winnfsd/issues/96#issuecomment-336105685

    关于homestead - fwrite() : write of XX bytes failed with errno=5 Input/output error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65569643/

    相关文章:

    laravel - Ubuntu 14 VBox 中的 Homestead - 设置错误

    Laravel Homestead 每个项目安装 Bash 别名命令未找到

    hadoop - MapR 分发中使用的容器架构是什么?

    postgresql - 启动 postgres 容器时出错 - mkdir : Permission denied

    Vagrant - 无法使用 Puphpet 和 SMB 挂载在 Linux Guest 中挂载文件夹

    laravel - 宅基地的多个文件夹不同步

    amazon-web-services - Laravel 5 Amazon AWS S3错误: Client error: 403 RequestTimeTooSkewed

    mysql - Docker nfs 卷 mysql - 如何修复 : "failed to copy file info"

    vagrant - 如何在 Vagrant 中自动选择桥接网络接口(interface)?