Large uploads don't work even after editing php.in

software development

#1

Hello,

Ive been having trouble with a php and JavaScript upload script accepting large file uploads. I realize that you are supposed to edit php.ini to change post max size and the memory limit, but it isn’t behaving as it should.

The only way I have ever successfully had a large file upload was switching to Dreamhost PS and making the memory limit as high as a file (1GB) but there has to be another cost effective way, otherwise how oils sites like YouTube survive? I get I/O errors if I do not have all this memory available.

Could anyone help? Ive struggled with this for over a month.


#2

Is your domain set to use mod_security (“Extra Web Security” in the Panel)? Try disabling that - when enabled, it doesn’t pass uploaded data to PHP until it’s all been received, so that it can scan it for potential security threats. This ends badly if you try to upload a gigabyte of data at once.

If that still doesn’t do it, you may need to write your upload script in something other than PHP. PHP really doesn’t handle uploads very well, and you may be able to do better by writing it yourself with FastCGI.


#3

Thanks andrewf. Extra web security was disabled.

I took your advice and rewrote the script handling the storage of the actual upload in CGI. Not even a blip on my memory usage. Thanks!


#4

Any chance you can share your resultant script tweaks with us or at least me? :slight_smile: Anonymized of possible?

Im trying to setup the same thing.
Thanks