1

I have a droplet on DigitalOcean, it was a 10$ package with 1GB Memory, then I upgraded to 20$ package.

So how it all started was that I'm trying to upload a file from one server to another using cURL parameters, now the issue is... The file doesn't send because I get this beautiful error.

PHP Fatal error:  Out of memory (allocated 1707606016) (tried to allocate 426680697 bytes)

Now I have memory_limit set to 2048MB because that's how much MB of memory I got on my VPS. Now before I upgraded, I had only 1024MB of memory and the error message was different at the time, and this is what I got.

PHP Fatal error:  Out of memory (allocated 530055168) (tried to allocate 529639729 bytes) 

My VPS has MORE than enough memory to upload a 403MB file, and I have my memory_limit maxed, there's no way I need to upgrade the servers memory limit.

memory_limit = 2048M
file_uploads = On
upload_max_filesize = 5000M
max_file_uploads = 20
allow_url_fopen = On
post_max_size = 0
max_execution_time = 90000
max_input_time = 90000

Obviously it may look like a duplicate, but the solutions on all of the posts I've looked at don't work for me. The script that is having its memory_limit is literally a handler that handles the cURL request sent from the alternative server.

Cameron Swyft
  • 328
  • 2
  • 5
  • 20
  • 5
    possible duplicate [http://stackoverflow.com/questions/6314733/php-fatal-error-out-of-memory-allocated-80740352-tried-to-allocate-12352-byt?rq=1](http://stackoverflow.com/questions/6314733/php-fatal-error-out-of-memory-allocated-80740352-tried-to-allocate-12352-byt?rq=1) –  May 12 '16 at 06:39
  • Too bad the solution on that post didn't work either. – Cameron Swyft May 12 '16 at 06:55
  • The problem here is that you have 2GB available but 1.7GB is already allocated so there really isn't enough for 426MB more (exceed 2GB) – e4c5 May 12 '16 at 08:06
  • How does it take over 2GB to send a file via cURL and use file_put_contents use so much? Especially if the file is 400mb – Cameron Swyft May 12 '16 at 08:07
  • 1
    Hi can you please post the code you are using to upload the files?. I wonder if its a memory leak kind of issue? – Aditya May 28 '16 at 10:15

3 Answers3

2

You can changed the php.ini

memory_limit = -1

and add to httpd.conf And restart Apache

Pratik Kamani
  • 698
  • 5
  • 21
1

I had the same issue in a DigitalOcean droplet of 1GB of RAM and 1CPU. Trying to install two differents LMS systems, Claroline and Chamilo. I upgraded the droplet to 2GB of RAM and same CPU.

The issue was solved. Deffintively it was something related to memmory limits.

Tadeo
  • 316
  • 3
  • 6
-1

You can changed the php.ini

memory_limit = 128M

and add to httpd.conf And restart and restart apache

Pankaj Chauhan
  • 1,241
  • 11
  • 12