Forum Moderators: coopster
I have a problem regarding uploading files. If i have a form on page1.html with a form containing one file-field.
When I click submit the file immediately starts uploading to the temp directory on the server. If this takes longer than 30 seconds it will not work. Since that is the standard time set in PHP... I know you can change this with a simple string of code. But! There is no time for that. Exactly when I click Submit the 30 seconds starts counting... I think....
I cannot edit my php.ini
Can anyone help with this.
The problem is that I cannot add the extra time in that set_time_limit. Cause the when someone click submit in the form-page the files start uploading immediately without running any scripts. So if I add the set_time_limit in the beginning that will execute after the files... I don't know maybe have the wrong basic concept to start with.
As far as I know it works like this. When I click the submit button PHP automatically upload the files to the temp-directory without involving any PHP-scripts. Therefore I cannot use the set_time_limit (I think). Cause the page uploads the files before anything else is executed. Am I right?
/Johan
Note: max_execution_time only affects 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(), the sleep() function, database queries, time taken by the file upload process, etc. is not included when determining the maximum time that the script has been running.<coopster side note here>:
If it was the script timing out, however, the max_execution_time directive also has a configuration option of PHP_INI_ALL. That means, you could create a per-directory configuration override on that value. On an apache server, this means placing an .htaccess file in that directory with a setting such as:
max_execution_time=300
which would change your script running time from 30 seconds to 5 minutes.
Therefore, assuming the script is never being executed, it would appear to be a server setting that is prohibiting you from uploading larger documents (now, the question is whether it is time or file size creating the problem). Apache has a configuration directive called LimitRequestBody [httpd.apache.org] that would make file size an issue. As far as Windows IIS goes, I found this in the user comments on the PHP: Handling file uploads manual [us2.php.net]:
This took me a few days to find out: when uploading large files with a slow connection to my WIN2K/IIS5/PHP4 server the POST form kept timing out at exactly 5 minutes. All PHP.INI settings were large enough to accomodate huge file uploads. Searched like crazy with keywords like "file upload php timeout script" until I realised that I installed PHP as CGI and added that as a keyword. This was the solution:To set the timeout value:
1. In the Internet Information Services snap-in, select the computer icon and open its property sheets.
2. Under Master Properties, select WWW Service, and then click the Edit button
3. Click the Home Directory tab.
4. Click the Configuration button.
5. Click the Process Options tab, and then type the timeout period in the CGI Script Timeout box.
Let us know
This is the error message and that is when the set_time_limit function is on the first row.
Fatal error: Maximum execution time of 30 seconds exceeded in d:\www-kunder\pixibit.com\temp_php\contributors\contributors_upload_submit.php on line 1
[edited by: jatar_k at 4:44 pm (utc) on Sep. 24, 2003]
[edited by: coopster at 3:56 pm (utc) on Oct. 5, 2005]
[edit reason] removed url [/edit]