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 1QAB8S-0006XM-Qq for garchives@archives.gentoo.org; Thu, 14 Apr 2011 01:14:17 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E97141C001; Thu, 14 Apr 2011 01:12:37 +0000 (UTC) Received: from mail2.viabit.com (mail2.viabit.com [65.246.80.16]) by pigeon.gentoo.org (Postfix) with ESMTP id C4C9C1C001 for ; Thu, 14 Apr 2011 01:12:37 +0000 (UTC) Received: from [192.168.1.100] (c-68-49-223-78.hsd1.md.comcast.net [68.49.223.78]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail2.viabit.com (Postfix) with ESMTPSA id 2886D37ADA for ; Wed, 13 Apr 2011 21:12:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=orlitzky.com; s=mail2; t=1302743557; bh=GT+/xdoQLkZNZxRI4Fe+Ka4H+cK4zcg4vdXFV8E57ZY=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=M6WmHXfEKvoFiyKqcNLUrvFhS/UliBeioJl97h+A0ZURMW5efDj7uaAOwj46w0vyW WsQDt/ul4+pKp5RBl/52bFNCZx96Xen/7iTXjD3OU+59Hlntfi414pEycXYyWZv3JN QaI0EtOE5b4RoxzD6HRiI+l5nlo9xsmMbUthXjLI= Message-ID: <4DA64A02.7030502@orlitzky.com> Date: Wed, 13 Apr 2011 21:12:34 -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> In-Reply-To: <201104132042.49914.Dan.Johansson@dmj.nu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Archives-Salt: X-Archives-Hash: 4c387cbcae491a8ec48f3a3e387f5a27 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?