In my php script larger file takes longer to uploa

2019-08-01 04:23发布

问题:

In my php script larger file takes longer to upload and its bound by max_execution_time. when max_execution_time was set to 60 and i was uploading files under 1MB there was no problem. once i uploaded a file over 3MB i kept getting a blank screen with no error on it.

Dont worry all upload limits are set and yes php display errors is on. The only way i was able to determine the problem was when i set my max_execution_time to 360.

Once i did that there was time out and upload went through successfully.

my problem is that users are allowed to upload much later files and there is no way of nowing how long to set max_execution_time for.

If it is set really high, like how i have it set to 360 seconds, then that means in theory every php process can take up to 360 seconds to execute, which can be very bad.

Someone please help me. This is a file hosting script.

thanks.

回答1:

Change the max execution time only when users are uploading files.

ini_set('max_execution_time', 360);


回答2:

I believe setting the 'max_input_time' php.ini variable will only affect the parsing of input variables, which includes POSTed file uploads.