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.

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.

Are you sure of the right syntax ? I think it's in bytes like

1000 bytes = 1Mo so just write the number without "G","Mb",etc.. But im not sure try it and return response :)

Can you check your .htaccess file in the project root directory or make sure that in the Symfony project files, the size is not limited with the PHP functions, which will overwrite the php.ini attributes.

Edit your php.ini file upload_max_filesize = 100000

Because if you write 1G it will not count 1 GB it sounts in byte so you will have to declare 1048576 for uploading limit of 1 GB