cURL, PHP, and Out Of Memory?

software development


I’ve got some PHP script to try and deliver some files for download… originally it used readfile, but that didn’t work out so well with Dreamhost, so I recoded it to use cURL instead. The download works perfect for a smaller zip file, about 3.5MB, but for the larger file, a little over 300MB, I get a file with the following:

Warning: curl_setopt(): supplied argument is not a valid cURL handle resource in [...] on line 53

Fatal error: Out of memory (allocated 75759616) (tried to allocate 75501890 bytes) in [...] on line 60

I’m not too sure where the problem lies… is it in the PHP? cURL commands?

Any help would be greatly appreciated… Thank you!


PHP has a memory limit specified in the ini file and 300mb is over that limit. Are you trying to relay files?

Read my blog. You know you want to…