From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QAmF4-0001b1-02 for garchives@archives.gentoo.org; Fri, 15 Apr 2011 16:51:34 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C05E11C007; Fri, 15 Apr 2011 16:50:08 +0000 (UTC) Received: from mail2.viabit.com (mail2.viabit.com [65.246.80.16]) by pigeon.gentoo.org (Postfix) with ESMTP id 8F5241C007 for ; Fri, 15 Apr 2011 16:50:08 +0000 (UTC) Received: from [172.17.29.6] (unknown [65.213.236.242]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail2.viabit.com (Postfix) with ESMTPSA id 9081937ADE for ; Fri, 15 Apr 2011 12:50:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=orlitzky.com; s=mail2; t=1302886207; bh=ZyV7bWhKTIbrZ6gHZq881Dq8cCTy6gGY9cPKdkY4SEk=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=WNUP/irUeoeBtz9Ga79MpO5HlIExjH4vyBBv2bt4ret0SO77wGyUmL5XPhbNIVBpQ QyvWe4oKA/GtE1CRXiN/knrjg6MgNWnDgGTUwKQIa/VY0vV+5zGF19OpPR6MWHQSNj TpKeJP4WJ8D3N2bF2cVFfisyNY/0825RFQCQQI/c= Message-ID: <4DA8773F.1000602@orlitzky.com> Date: Fri, 15 Apr 2011 12:50:07 -0400 From: Michael Orlitzky User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20110404 Lightning/1.0b3pre Thunderbird/3.1.7 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] [OT] PHP memory problem References: <201104132042.49914.Dan.Johansson@dmj.nu> <4DA64A02.7030502@orlitzky.com> <201104151726.13176.Dan.Johansson@dmj.nu> In-Reply-To: <201104151726.13176.Dan.Johansson@dmj.nu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Archives-Salt: X-Archives-Hash: 1b38bbc456dd99c87d9ba9b6d8df7e50 On 04/15/2011 11:26 AM, Dan Johansson wrote: > On Thursday 14 April 2011 03.12:34 Michael Orlitzky wrote: >> On 04/13/2011 02:42 PM, Dan Johansson wrote: >>> I know this is Off-topic but I also know there are a lot of smart people >>> "lurking" on this list. >>> >>> I have a PHP-script that does not run from a web-server but directly in a >>> shell. When I run it I get the following error: >>> >>> # ./dj.php >>> PHP Fatal error: Allowed memory size of 100663296 bytes exhausted (tried >>> to allocate 104 bytes) in /usr/local/scripts/includes/dj.inc on line 79 >>> Allowed memory size of 100663296 bytes exhausted (tried to allocate 24 >>> bytes) >>> >>> My scripts starts with: >>> #!/usr/bin/php >>> >> >>> ini_set('memory_limit', '4192M'); >>> >>> include "dj.inc"; >>> >>> And in php.ini I have: >>> memory_limit = 1G ; Maximum amount of memory a script may consume >>> >>> Why does PHP not honor my memory limits? >>> I have set 1GB in php.ini and 4192MB (I know that is more then 1GB) and >>> the scripts fails at 100663296 bytes (~ 96MB). I have also tried with >>> other memory settings but I always end up with with the failure at >>> ~96MB. The host has enough RAM (32GB) to support the script. >>> >>> Any suggestions on how to solve the issue (short of rewriting the script >>> in C or C++)? >> >> The use of 'G' as a unit was only "recently" added, in PHP 5.1.0. Try >> using 'M' instead, and multiplying by 1024. >> >> I would also suggest using a number under 4 gigabytes, as you risk >> overflowing a 32-bit integer. Does '3072M' work? > > Thanks, that was it. Changing 4G to 4192M in pnp.ini did solve the issue. > > Regards, Life lesson: if you ever have a PHP problem and think, "there's no way that's the problem, nobody is that retarded." That's probably the problem =)