doushuo1989 2016-05-24 07:36
浏览 77
已采纳

PHP文件上传 - 内存不足

I have a Symfony application using Sonata admin and Sonata media my client uses to upload mp4 videos. The problem is these files are getting bigger and bigger (> 1go) and I now have trouble with "out of memory" apache errors.

The website is hosted on an AWS EC2 ubuntu instance (PHP, Apache2). I set the php.ini parameters like this:

upload_max_filesize = 1G
post_max_size = 2G
memory_limit = -1

I did this for cli and apache2 under /etc/php/7.0/. I tried various combinations and higher values. Always restart apache afterwards. I even tried rebooting the instance. I can't get to upload more than 350mo.

  • 写回答

4条回答 默认 最新

  • douhuang1852 2016-05-24 09:35
    关注

    OK, I found a solution. Here's how I did it.

    First of all, i stopped my EC2 instance, detached the volume and made a snapshot of it.

    From the snapshot, I created a bigger volume (30Go for now). I reattached it to my EC2 instance, which I rebooted.

    I logged in through SSH and installed a swapspace (3Go). Tweaked it a little following this.

    I cleant the cache, restarted my EC2 instance one last time and... well I just uploaded 1Go in 20 minutes.

    One issue though : stopping and starting my EC2 instance I lost my IP and had to change my DNS zone. It's gonna take a few hours for the website to be back...

    Hope this will be helpful to someone.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥50 adb连接不到手机是怎么回事?
  • ¥15 vs2022无法联网
  • ¥15 TCP的客户端和服务器的互联
  • ¥15 VB.NET操作免驱摄像头
  • ¥15 笔记本上移动热点开关状态查询
  • ¥85 类鸟群Boids——仿真鸟群避障的相关问题
  • ¥15 CFEDEM自带算例错误,如何解决?
  • ¥15 有没有会使用flac3d软件的家人
  • ¥20 360摄像头无法解绑使用,请教解绑当前账号绑定问题,
  • ¥15 docker实践项目