Vichuploader 破坏实体 - 意外的 EOF

Vichuploader breaks entity - Unexpected EOF

我正在安装软件包 Vichuploader (https://github.com/dustin10/VichUploaderBundle)。
为了在没有其他输入从实体更改时上传文件,我迁移了我的实体以添加 updated_at 字段。

这次迁移后,我的实体不再更新。 我可以毫无问题地创建一个新实体,但我有奇怪的(非 500)错误:

Fatal error: Maximum execution time of 30+2 seconds exceeded (terminated) in /Users/alphabetus/Documents/repos/fluid-cms/src/Controller/BlockController.php on line 181  

ERROR| SERVER issue with server callback error="unable to fetch the response from the backend: unexpected EOF"  

ERROR| SERVER POST (502) /admin/blocks/edit/706ae964-e2c1-11ea-b09a-69c7fbc1be88 host="127.0.0.1:8004" ip="::1" scheme="https"

我的第 181 行包含以下内容:

    /**
     * @return File\Null
     */
    public function getImageFile()
    {
        return $this->image_file; // line 81
    }

    public function setImageFile(File $image_file = null): void
    {
        $this->image_file = $image_file;
        if ($image_file) {
            $this->updated_at = new \DateTime('none');
        }
    }

我是 symfony 的新手。我究竟做错了什么? 谢谢

从您的错误消息来看,处理文件所需的时间太长(超过 30 秒),因此您的 PHP 服务器终止了该进程。 您可以在 php.ini.

中使用 set_time_limit in your index.php file or change the max_execution_time

此外,错误指向第 181 行 BlockController.php 而不是您的实体。

如果这不能解决您的问题,请提供更多 details/code。我已经使用了很多 VichUploderBundle(包括 updatedAt 触发器),没有任何问题。