Make WordPress Core

Opened 10 years ago

Last modified 6 years ago

#31372 new defect (bug)

media-new.php stops uploading after max_execution_time set in php.ini

Reported by: aumerci's profile au.merci Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.1
Component: Upload Keywords:
Focuses: Cc:

Description

Environement

Windows Server 2008 (version 6, build 6002: SP2)
IIS Version 7.0.6000.16386
PHP Version 5.4.26
FastCGI

Problem

When uploading a media file to Wordpress the upload only runs for the max_execution_time set in php.ini. When that time has elapsed (for slow connections or a large file) the multi-file uploader displays the generic error "HTTP error." The browser uploader stops with the PHP error "max execution time reached"
Is this behavior by design?

Proposed solutions

  1. set set_time_limit(0) in media-new.php, so a upload can take as long as it needs
    For IIS this solution is preferred, because FastCGI automatically stops script execution when a connection is lost. For Apache the additional code ignore_user_abort(false); might be needed to prevent the script from executing after the client has aborted, although that also is the standard behavior for Apache I think.
  2. Display a more helpful error
    "HTTP error." could practially mean everything. It took me at least 2 hours to find out what was causing the error. Displaying "Your upload exceeded the max_execution_time set in PHP" makes things already a lot more understandable.

Thoughts about limits

File uploads are already limited by max_upload_size and max_post_size, so it should make sense to not also limit them on how long they can take.
Some users simply don't have a fast enough connection to complete the file upload in the max_execution_time specified by php.ini

Change History (2)

#1 @au.merci
10 years ago

  • Focuses performance removed
Note: See TracTickets for help on using tickets.