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 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了