[pmwiki-users] Problem with indirect download of large files
Patrick R. Michaud
pmichaud at pobox.com
Wed Nov 9 11:50:56 CST 2005
On Fri, Nov 04, 2005 at 01:35:46PM +0100, Daniel Scheibler wrote:
> Hello,
>
> I detect a little problem with indirect downloads.
>
> I uploaded a large file (>50 MB), maybe xyz.zip, via ftp into the
> upload directory of a wiki page. Then I write Attach:xyz.zip into this
> wiki page.
>
> Clicking the resulting link cause a error message in my webserver log file like:
> PHP Fatal error: Allowed memory size of 16777216 bytes exhausted
> (tried to allocate 10240 bytes) in /path/to/pmwiki/scripts/upload.php
> on line 169
There are times when PHP really stinks. Apparently PHP's readfile
function is reading the entire attachment file into memory before
sending it to the browser. This is horribly wasteful of memory and
system resources (and, as you've discovered, it breaks when the
file size exceeds the memory limit).
I'll rewrite PmWiki to read and send the file in smaller chunks,
which will resolve this problem.
Pm
More information about the pmwiki-users
mailing list