tags:

views:

51

answers:

2

I have an upload form that uploads mp3s to my site. I have some intermittent issues with some users which I suspect to be slow upload connections... But anyway the first line of code is set_time_limit(0); which did fix it for SOME users that had connections that were taking a while to upload, but some are still getting timed out and I have no idea why. It says the script has exceeded limit execution of 60 seconds. The script has no loops so it's not like it's some kind of coding loop error. The weird thing is that no matter what line of code is in the first line it will always say "error on line one, two, etc" even if it's set_time_limit(0);. I tried erasing it and the very first line of code always seems to be the error, it doesn't even give me a hint of why it can't execute the php page. This is an issue only few users are experiencing and no one else seems to be affected. Could anyone throw some ideas as to why this could be happening?

+3  A: 

set_time_limt() will only effect the actual execution of the PHP code on the page. You want to set the PHP directive max_input_time, which controls how long the script will accept input (like files) for. The catch is that you need to set this in php.ini, as if the default max_input_time is exceeded, it'll never reach the script which is attempting to change it with ini_set().

Mike Sherov
Thanks, this seemed to have solved my problem! :)
Tek
A: 

Sure, a couple of things noted in the PHP Manual.

Make sure PHP is not running in safe-mode. set_time_limit has no affect when PHP is running in safe_mode.

Second, and this is where I assume your problem lies..... Note: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. This is not true on Windows where the measured time is real.

So your stream may be the culprit.

Can you post a little of your upload script, are you calling a separate file to handle the upload using Headers?

Senica Gonzalez Allebrum

Senica Gonzalez