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条)

报告相同问题?

悬赏问题

  • ¥15 prism提示我reinstall prism 如何解决
  • ¥15 asp.core 权限控制怎么做,需要控制到每个方法
  • ¥20 while循环中OLED显示中断中的数据不正确
  • ¥15 这个视频里的stm32f4代码是怎么写的
  • ¥15 JNA调用DLL报堆栈溢出错误(0xC00000FD)
  • ¥15 请教SGeMs软件的使用
  • ¥15 自己用vb.net编写了一个dll文件,如何只给授权的用户使用这个dll文件进行打包编译,未授权用户不能进行打包编译操作?
  • ¥50 深度学习运行代码直接中断
  • ¥20 需要完整的共散射点成像代码
  • ¥15 编写vba代码实现数据录入工作