Question

I'm currently working on a upload script supporting larger uploads (~50 Mb) and I have very rapidly run into a problem! I'm using the traditional POST request with a form uploading the file to a temp location and later moving it with PHP. Naturally I've updated my php.ini file to support slightly larger than default files and files around 15 Mb upload really well!

The main problem is due to my hosting company. They let scripts timeout after 60 seconds meaning that POST requests taking longer than 60 seconds to complete will die before the temp file reaches the PHP script and this naturally yields an internal server error.

Not being able to crank the timeout on the server (after heated debates) I'm considering the options. Is there a way to bump the request or somehow refresh it to notify the server and reset the timing? Or are there alternative upload methods that don't timeout?

Was it helpful?

Solution

With great difficulty. By far your easiest option is to dump the hard-headed host and pick one that actually lets you be productive. I personally use TSOHost - been with them for over a year and a half and have so far had absolutely no reason to complain (not even a slight annoyance).

OTHER TIPS

There are a few things you could consider. Each has a cost, and you'll need to determine which one is least costly.

  1. Get a new hosting company. This may be your best solution.

  2. Design a rather complex client-side system that breaks up the upload into multiple chunks and submits them via AJAX. This is ugly especially since it is only useful in getting around a host rule.

I'd really research #1.

Are you really sure it s a timeout issue? My first idea...

  • the transfert failed due to a configuration limitation set up in the web server php.ini file. You need to change it or set it as local settings in your script

    # find it in php.ini used by your configuration memory_limit = 96M post_max_size = 64M upload_max_filesize = 64M

Or directly inyour script

ini_set('memory_limit', '96M'); 
ini_set('post_max_size', '64M'); 
ini_set('upload_max_filesize', '64M');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top