public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Michael Orlitzky <michael@orlitzky.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] [OT] PHP memory problem
Date: Wed, 13 Apr 2011 21:12:34 -0400	[thread overview]
Message-ID: <4DA64A02.7030502@orlitzky.com> (raw)
In-Reply-To: <201104132042.49914.Dan.Johansson@dmj.nu>

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
> <?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?



  reply	other threads:[~2011-04-14  1:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 18:42 [gentoo-user] [OT] PHP memory problem Dan Johansson
2011-04-14  1:12 ` Michael Orlitzky [this message]
2011-04-15 15:26   ` Dan Johansson
2011-04-15 16:50     ` Michael Orlitzky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DA64A02.7030502@orlitzky.com \
    --to=michael@orlitzky.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox