Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60392 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79046 invoked from network); 1 May 2012 14:27:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 May 2012 14:27:14 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.212.42 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:38308] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/46-38165-FB2FF9F4 for ; Tue, 01 May 2012 10:27:13 -0400 Received: by vbjk13 with SMTP id k13so3124057vbj.29 for ; Tue, 01 May 2012 07:27:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=QrsSme3HKH9vLcET8QrnbnyVS1pVGrewAw4yQnxsJW8=; b=KA7r3jJcmN1exN7C48O+HpGzMJVRqiD9icTV6hUKN/9Jmw8PD6kRzlBRf/68RII+bM LpEYZffNPWsBmNfN4JFqVgxAX7IUM31VKIWwKk/6rE6tfrC6+oz3lMs4tJ62ASlEH4HC EbgiqR1Wz5KnGt0U9ykZeLGNJchpqM1N8ownh+3094htosc2aCvD38d2zOfVfW9njfQT HRra+0gaMDHhundSx31q8qmBO8IEXROLHwAYK3bV+OidpRTcS+No9hVdcNiT7ZGGbchC sFt/K66hy2xvFiWrBUd+D6mZQLn3sYxbVPlb4Dq5k5qlFaALGQlz4QkCwUiNyunoec7Y PxMw== Received: by 10.220.152.205 with SMTP id h13mr21373194vcw.12.1335882428564; Tue, 01 May 2012 07:27:08 -0700 (PDT) Received: from [192.168.200.5] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPS id d7sm32363983vdu.15.2012.05.01.07.27.06 (version=SSLv3 cipher=OTHER); Tue, 01 May 2012 07:27:07 -0700 (PDT) Message-ID: <4F9FF2B9.7060301@lerdorf.com> Date: Tue, 01 May 2012 07:27:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120410 Thunderbird/11.0.1 MIME-Version: 1.0 To: Paul Reinheimer CC: internals@lists.php.net, Larry Garfield References: <4F9E2173.50005@garfieldtech.com> <000e01cd269a$06f15230$14d3f690$@php.net> <002701cd26b5$1cd0bb70$56723250$@thetaphi.de> <4F9EC8B4.3040600@garfieldtech.com> <4F9F4208.7020106@garfieldtech.com> In-Reply-To: X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQk2oFde0bSd6N2IsRMkICRvscGEwF+4cAx6nIOlbLHuiNCQ8hTnxLBAGdRUufj0mXLz630v Subject: Re: [PHP-DEV] readfile() memory usage From: rasmus@lerdorf.com (Rasmus Lerdorf) On 05/01/2012 06:39 AM, Paul Reinheimer wrote: > Hi Larry, > >> Fascinating. I even verified the md5sum of the file I got on the other end >> just to be sure. I'll hold off on the blog post then. :-) I look forward >> to your test setup. > > The server in question is still on PHP 5.2.13 > > Script: > ini_set('memory_limit', '8M'); > $name = uniqid() . ".zip"; > header('Content-type: application/zip'); > header("Content-Disposition: attachment; filename=\"$name\""); > readfile('../../filestorage/4f9e9e3b9bcff.zip'); > > File Information: > [user@host public]$ ls -alh ../../filestorage/4f9e9e3b9bcff.zip > -rw-r--r-- 1 apache apache 27M Apr 30 10:14 ../../filestorage/4f9e9e3b9bcff.zip > > Error: > [Tue May 01 09:30:48 2012] [error] [client 198.136.162.2] PHP Fatal > error: Allowed memory size of 8388608 bytes exhausted (tried to > allocate 27617281 bytes) in > /home/lots/of/path.org/stuff/public/rf822.php on line 6 > > > I'll try something newer, but I wanted to prove myself not crazy and > do it on the server in question first. That's odd, because PHP 5.2 has identical code in this respect. Wez committed these changes in 2002: https://github.com/php/php-src/commit/a662f012bba5a6fdc50533673f3fff47bf9af219#diff-5 So it has been like this for quite a while. Does that server have implicit unlimited output buffering turned on in your ini file? -Rasmus