Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10339 > unrolled thread

ini_get("memory_limit") returns an empty string

Started byjaialai.technology@gmail.com
First post2013-08-02 01:18 -0400
Last post2013-08-03 22:28 -0400
Articles 5 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  ini_get("memory_limit") returns an empty string jaialai.technology@gmail.com - 2013-08-02 01:18 -0400
    Re: ini_get("memory_limit") returns an empty string Denis McMahon <denismfmcmahon@gmail.com> - 2013-08-02 15:11 +0000
    Re: ini_get("memory_limit") returns an empty string Jerry Stuckle <jstucklex@attglobal.net> - 2013-08-02 11:25 -0400
    Re: ini_get("memory_limit") returns an empty string "J.O. Aho" <user@example.net> - 2013-08-02 17:53 +0200
      Re: ini_get("memory_limit") returns an empty string jaialai.technology@gmail.com - 2013-08-03 22:28 -0400

#10339 — ini_get("memory_limit") returns an empty string

Fromjaialai.technology@gmail.com
Date2013-08-02 01:18 -0400
Subjectini_get("memory_limit") returns an empty string
Message-ID<6e82$51fb4122$484a174a$29006@news.eurofeeds.com>
I am using php 5.3.3 on Cent OS 6.
I find that in my web application that a call to ini_get("memory_limit") 
returns an empty string.
When I try and reproduce this error in a command line script
I cannot reproduce this behavior.

Does anyone here have any experience with this unexpected behavior?
If so, what causes this to happen? Seemingly it only occurs when the 
code is executed via Apache?

[toc] | [next] | [standalone]


#10343

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2013-08-02 15:11 +0000
Message-ID<ktgi6u$d4j$1@dont-email.me>
In reply to#10339
On Fri, 02 Aug 2013 01:18:24 -0400, jaialai.technology wrote:

> I am using php 5.3.3 on Cent OS 6.
> I find that in my web application that a call to ini_get("memory_limit")
> returns an empty string.
> When I try and reproduce this error in a command line script I cannot
> reproduce this behavior.
> 
> Does anyone here have any experience with this unexpected behavior?
> If so, what causes this to happen? Seemingly it only occurs when the
> code is executed via Apache?

Check you actually have a memory limit set:

$ grep memory_limit /etc/php5/apache2/php.ini
memory_limit = 128M
$ 

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#10344

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-08-02 11:25 -0400
Message-ID<ktgikl$96k$1@dont-email.me>
In reply to#10339
On 8/2/2013 1:18 AM, jaialai.technology@gmail.com wrote:
> I am using php 5.3.3 on Cent OS 6.
> I find that in my web application that a call to ini_get("memory_limit")
> returns an empty string.
> When I try and reproduce this error in a command line script
> I cannot reproduce this behavior.
>
> Does anyone here have any experience with this unexpected behavior?
> If so, what causes this to happen? Seemingly it only occurs when the
> code is executed via Apache?

Can't say as I've seen it.  What's your entire code?  And what does 
phpinfo() show?

Even if you don't set a memory limit, PHP should have a default (128M).

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#10345

From"J.O. Aho" <user@example.net>
Date2013-08-02 17:53 +0200
Message-ID<b622uvFps4bU1@mid.individual.net>
In reply to#10339
On 02/08/13 07:18, jaialai.technology@gmail.com wrote:
> I am using php 5.3.3 on Cent OS 6.
> I find that in my web application that a call to ini_get("memory_limit")
> returns an empty string.

Do you get an empty string or false?
var_dump(ini_get("memory_limit"));

If you actually get an false value, then you managed to enter some 
invisible characters into the string and those the value can't be found.

Empty string and false looks the same if you are doing

echo ini_get("memory_limit");


> When I try and reproduce this error in a command line script
> I cannot reproduce this behavior.

you using the same script or you written another one? If later than you 
have not got the invisible characters and those it "works" as you expect 
in cli while it seem to work trough Apache.


-- 

  //Aho

[toc] | [prev] | [next] | [standalone]


#10370

Fromjaialai.technology@gmail.com
Date2013-08-03 22:28 -0400
Message-ID<7194d$51fdbc65$484a174a$28890@news.eurofeeds.com>
In reply to#10345
On 8/2/13 11:53 AM, J.O. Aho wrote:
> On 02/08/13 07:18, jaialai.technology@gmail.com wrote:
>> I am using php 5.3.3 on Cent OS 6.
>> I find that in my web application that a call to ini_get("memory_limit")
>> returns an empty string.
>
> Do you get an empty string or false?
> var_dump(ini_get("memory_limit"));
>
> If you actually get an false value, then you managed to enter some
> invisible characters into the string and those the value can't be found.
>
> Empty string and false looks the same if you are doing
>
> echo ini_get("memory_limit");
>
>
>> When I try and reproduce this error in a command line script
>> I cannot reproduce this behavior.
>
> you using the same script or you written another one? If later than you
> have not got the invisible characters and those it "works" as you expect
> in cli while it seem to work trough Apache.
Thank you (and everyone else on this thread!) for the advice.
Turns out that a bit of third party code is calling ini_set() and 
screwing everything up. I just didn't realize it when I made my post.
This whole business of calling ini_set() is pretty evil!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web