php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13094 Upload very slow
Submitted: 2001-09-02 07:34 UTC Modified: 2002-03-07 13:28 UTC
From: mvl at lionsolutions dot nl Assigned: sniper (profile)
Status: Closed Package: Performance problem
PHP Version: 4.0.6 OS: Windows 2000
Private report: No CVE-ID: None
 [2001-09-02 07:34 UTC] mvl at lionsolutions dot nl
?php
if(is_uploaded_file($userfile))
 {
	$FileNameAdd = $FileName;						//Prefix for filename using uniqid();
	$FileNameAddDB = $DBFileName;				//Including prefix used for database
	$filename = $HTTP_POST_FILES['userfile']['name'];	//Filename as selected by user
	$FileExt = substr(strrchr($filename, "."), 1);
	if(array_search($FileExt, $Extensions) == FALSE)
	{
?>
		<font class="warning">Not allowed to upload this file.</font>
<?php
		exit();
	}
	$DBFileSize = $HTTP_POST_FILES['userfile']['size'];
	$DBFileName = $FileNameAddDB.$filename;			
	move_uploaded_file($userfile, $Mapping . $FileNameAdd.$filename);
?>

Didn't compile anything just use the compiled version as download from website.

When I upload a file bigger than 10 MB, it takes a very long time (if it uploads) I adjusted all the needed variables in php.ini. 
I'm using it for files (>150MB) over a Lan network.
I've tried a ASP uploader and it does the same file in less then three minutes. PHP was working for 30 minutes and still wasn't done. 
I think this is a bug in the code.

Marcel van Leeuwen
Netherlands

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-02 11:17 UTC] jeroen@php.net
Seems duplicate of 2291, but that one should be fixed in 4.0.6
 [2001-09-02 11:57 UTC] jeroen@php.net
This has nothing to do with 2291.

The problem probably is that PHP takes all HTTP-post data into it's memory, and only after the complete header (WITH all files) are in-memory, php_mime_split is called to get the files out of the request and save them to disk.

So if you need to recieve file-uploads of 100MB or something, PHP needs 100MB of RAM... otherwise it will swap and thus be terribly slow (especially on Windows)

A real solution would be to rewrite php_mime_split to run on-the-fly... which at first glance isn't terribly hard.
 [2001-09-02 16:52 UTC] jeroen@php.net
Work in progress...
 [2001-10-28 12:10 UTC] jeroen@php.net
Fixed in CVS by Jani, will be fixed in 4.2.0
 [2001-10-28 12:34 UTC] sniper@php.net
This should be fixed in CVS now. You can try the latest 
development build from http://www.php4win.com/ but make
sure it's dated after 27th of October 2001.

Also, there are some minor leaks still in the new code.
If you encounter such leaks, please send the shortest
possible code + html with which you can reproduce the leak
to php-dev@lists.php.net (or me) so we can get rid of these
leaks. 

The fix will be in PHP 4.2.0.

--Jani


 [2002-03-02 10:47 UTC] jimmy at _ANTISPAM_lusidor dot com
Has this problem been solved in the update for 4.1.2?
 [2002-03-02 10:50 UTC] derick@php.net
No, only for 4.2.x

Derick
 [2002-03-07 13:11 UTC] mvl at lionsolutions dot nl
When is this release (4.2.x) due?
 [2002-03-07 13:28 UTC] derick@php.net
In about two months.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 02:02:52 2024 UTC