不同的下载文件取决于服务器

Different downloaded file depending on the server

我将此代码与 Symfony 2.8 一起使用:

protected function getFiles(FileBag $bag)
{
    $files = array();
    $fileBag = $bag->all();
    dump($fileBag);
    ....
}

在我的开发环境中(Ubuntu 16.04PHP 5.6Apache 2),$fileBag 很好:

array:1 [▼
  "listing" => array:1 [▼
    "image" => array:1 [▼
      "new" => array:1 [▼
        0 => UploadedFile {#14 ▼
          -test: false
          -originalName: "logo2.gif"
          -mimeType: "image/gif"
          -size: 7719
          -error: 0
          path: "/tmp"
          filename: "phpPymk91"
          basename: "phpPymk91"
          pathname: "/tmp/phpPymk91"
          extension: ""
          realPath: "/tmp/phpPymk91"
          aTime: 2017-04-26 14:49:16
          mTime: 2017-04-26 14:49:16
          cTime: 2017-04-26 14:49:16
          inode: 278115
          size: 7719
          perms: 0100600
          owner: 33
          group: 33
          type: "file"
          writable: true
          readable: true
          executable: false
          file: true
          dir: false
          link: false
        }
      ]
    ]
  ]
]

但是在服务器中 (azure Ubuntu 14.04, PHP 5.5) 我有这样的结果:

array:1 [▼
  "listing" => array:1 [▼
    "image" => array:1 [▼
      "new" => array:1 [▼
        0 => UploadedFile {#14 ▼
          -test: false
          -originalName: "logo2.gif"
          -mimeType: "application/octet-stream"
          -size: 0
          -error: 1
          path: ""
          filename: ""
          basename: ""
          pathname: ""
          extension: ""
          realPath: "/var/www/html/web"
          aTime: 1970-01-01 01:00:00
          mTime: 1970-01-01 01:00:00
          cTime: 1970-01-01 01:00:00
          inode: false
          size: false
          perms: 00
          owner: false
          group: false
          type: false
          writable: false
          readable: false
          executable: false
          file: false
          dir: false
          link: false
        }
      ]
    ]
  ]
]

路径、大小、mimeType...都不好。

php.ini长得一样

你有想法吗?

它在 php.ini

中丢失了 output_buffering = On

感谢您的建议和