duan97689
2016-07-09 10:07
浏览 187
已采纳

上传图像SilverStripe时,PHP错误'Filesize为零字节'

I have just set up a new Centos 7 server and uploaded my SilverStripe project via a Capistrano deployment. All is working well except for the file upload where I get a 'Filesize zero bytes' when uploading images.

The assets folder is symlinked to a shared folder outside of the website root.

website
- current
- - (website root)
- shared
- - assets
- - - (uploads)
- - vendor
- - - (composer managed deps)

The file I am uploading is 16kb.

Permissions on all files and directories are set to deployer:apache 755 and permissions on the assets folder has been set to 775 (set it to 777 still with no luck).

There was another post I read that mention php config could be an issue. Here are some of the relevant php settings:

  • max_execution_time: 30
  • max_file_uploads: 20
  • max_input_time: 60
  • post_max_size: 8M
  • upload_max_filesize: 2M
  • upload_tmp_dir: /tmp

Not sure if there are any others that may be on interest, let me know and I will post them.

图片转代码服务由CSDN问答提供 功能建议

我刚刚设置了一个新的Centos 7服务器并通过Capistrano部署上传了我的SilverStripe项目。 一切都运行良好,除了文件上传,我在上传图像时得到'Filesize zero bytes'。

assets文件夹符号链接到网站根目录之外的共享文件夹。

  website 
- current 
-  - (网站root)
-共享
-  -  assets 
  -   -   - (上传)
-  -  vendor 
-  - (composer managed deps)
   
 
 

我上传的文件是16kb。

所有文件和目录的权限都是 设置为deployer:apache 755和assets文件夹的权限设置为775(仍然没有运气设置为777)。

我读到的另一篇文章提到php config可以 是一个问题。 以下是一些相关的php设置:

  • max_execution_time:30
  • max_file_uploads:20
  • max_input_time :60
  • post_max_size:8M
  • upload_max_filesize:2M
  • upload_tmp_dir:/ tmp \ n

    不确定是否有其他可能有兴趣的人,请告诉我,我会发布。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dorbmd1177 2016-07-11 00:07
    最佳回答

    This is usually due to permissions on the assets directory.

    Change the owner of both the symlink and the folder it is linked to

    sudo chown -R deployer:apache assets
    sudo chown -R deployer:apache /path/to/assets
    

    You might also need to do sudo chmod g+w assets and sudo chmod g+w /path/to/assets to allow other group members to write to your directory.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题