ini_get("memory_limit") returns an empty string [message #182388] |
Fri, 02 August 2013 05:18 |
jaialai.technology
Messages: 2 Registered: August 2013
Karma: 0
|
Junior Member |
|
|
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?
|
|
|
Re: ini_get("memory_limit") returns an empty string [message #182392 is a reply to message #182388] |
Fri, 02 August 2013 15:11 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
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(at)gmail(dot)com
|
|
|
Re: ini_get("memory_limit") returns an empty string [message #182393 is a reply to message #182388] |
Fri, 02 August 2013 15:25 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 8/2/2013 1:18 AM, jaialai(dot)technology(at)gmail(dot)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(at)attglobal(dot)net
==================
|
|
|
Re: ini_get("memory_limit") returns an empty string [message #182394 is a reply to message #182388] |
Fri, 02 August 2013 15:53 |
J.O. Aho
Messages: 194 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 02/08/13 07:18, jaialai(dot)technology(at)gmail(dot)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
|
|
|
Re: ini_get("memory_limit") returns an empty string [message #182419 is a reply to message #182394] |
Sun, 04 August 2013 02:28 |
jaialai.technology
Messages: 2 Registered: August 2013
Karma: 0
|
Junior Member |
|
|
On 8/2/13 11:53 AM, J.O. Aho wrote:
> On 02/08/13 07:18, jaialai(dot)technology(at)gmail(dot)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!
|
|
|