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 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答