Bug #13094 Updated: Upload very slow
| From: | sniper@php.net | Date: | Sun, 28 Oct 2001 17:34:17 +0000 |
| Subject: | Bug #13094 Updated: Upload very slow | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-69201@lists.php.net to get a copy of this message | ||
ID: 13094
Updated by: sniper
Reported By: mvl@lionsolutions.nl
Status: Closed
Bug Type: Performance problem
Operating System: Windows 2000
PHP Version: 4.0.6
Assigned To: sniper
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2001-10-28 12:10:12] jeroen@php.net
Fixed in CVS by Jani, will be fixed in 4.2.0
------------------------------------------------------------------------
[2001-09-02 16:52:23] jeroen@php.net
Work in progress...
------------------------------------------------------------------------
[2001-09-02 11:57:36] 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 11:17:11] jeroen@php.net
Seems duplicate of 2291, but that one should be fixed in 4.0.6
------------------------------------------------------------------------
[2001-09-02 07:34:53] mvl@lionsolutions.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
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13094&edit=1