From: Larry Martell on
I have an app that runs just fine on an older Solaris apache server
(Apache/2.0.53 PHP/5.0.4), but when I run the same app on a newer
Linux server (Apache/2.2.3-11 PHP/5.2.8) against the same database on
the same mysql server, it fails with "Allowed memory size exhausted".
This occurs on a:

$result = mysql_query($query, $db)

statement. Both servers are running the identical query, which returns
a result set under 0.5M. The Solaris server is configured with
memory_limit = 8M in php.ini, and the Linux one with 32M, so clearly
something other then what I'm seeing is going on. Anyone know what
could be causing this? Any php or apache build or config options that
I could look at?

TIA!
From: Larry Martell on
On Tue, Jul 13, 2010 at 11:11 AM, Ashley Sheridan
<ash(a)ashleysheridan.co.uk> wrote:
>
> On Tue, 2010-07-13 at 11:06 -0600, Larry Martell wrote:
>
> I have an app that runs just fine on an older Solaris apache server
> (Apache/2.0.53 PHP/5.0.4), but when I run the same app on a newer
> Linux server (Apache/2.2.3-11 PHP/5.2.8) against the same database on
> the same mysql server, it fails with "Allowed memory size exhausted".
> This occurs on a:
>
> $result = mysql_query($query, $db)
>
> statement. Both servers are running the identical query, which returns
> a result set under 0.5M. The Solaris server is configured with
> memory_limit = 8M in php.ini, and the Linux one with 32M, so clearly
> something other then what I'm seeing is going on. Anyone know what
> could be causing this? Any php or apache build or config options that
> I could look at?
>
> TIA!
>
>
> Is there any other place which your code is changing the memory_limit parameter? I would assume this is unlikely, but sometimes even the unlikely happens more than than it should!

The error message actually says "Allowed memory size of 3355432 bytes
exhausted" so I know it's using the 32M that it's set to php.ini. But
as I wrote above, on the Solaris server where it works, the
memory_limit is set to 8M.

> Can you maybe strip the code down to a test case which causes the error?

I've already done that - all it does it run a query and display the results.

> Lastly, I do notice that you've got two different versions of PHP & Apache installed on each OS, which could be the reason for the failure.

Well, yes, that's what I said. And they may been built with different
config options. But what options could cause a difference like this?

> Maybe set up a VM or two to test things out. Have one VM with Solaris and Apache/2.2.3-11 & PHP/5.2.8, and another VM with Apache/2.0.53 & PHP/5.0.4 and see what happens. It could be that it's either Apache or PHP or both
> causing the problems on your Linux system.

I don't have control of that. This is at a client site - they want to
get rid of their existing older Solaris apache server and move to a
newer Linux one. The servers are already set up they way they are. I
asked the admis for info on the build - they have it for the newer
Linux one, but not for the older Solaris one. They did give me another
machine to test on - that one is Linux, Apache 2.2.3, PHP 5.2.6 - that
also gets the out of memory error.
From: Nathan Nobbe on
On Tue, Jul 13, 2010 at 11:06 AM, Larry Martell <larry(a)software-horizons.com
> wrote:

> I have an app that runs just fine on an older Solaris apache server
> (Apache/2.0.53 PHP/5.0.4), but when I run the same app on a newer
> Linux server (Apache/2.2.3-11 PHP/5.2.8) against the same database on
> the same mysql server, it fails with "Allowed memory size exhausted".
> This occurs on a:
>
> $result = mysql_query($query, $db)
>
> statement. Both servers are running the identical query, which returns
> a result set under 0.5M. The Solaris server is configured with
> memory_limit = 8M in php.ini, and the Linux one with 32M, so clearly
> something other then what I'm seeing is going on. Anyone know what
> could be causing this? Any php or apache build or config options that
> I could look at?
>

are you sure the app doesnt have some other data loaded into memory before
running the query on the linux box?

you can use memory_get_usage() right before executing the query on the linux
box to determine if thats the case.

for example suppose the query takes .5M of memory, when you run it on the
solaris box only 4M of memory is currently in use and when you run it on the
linux box 31.7M of memory is in use.

another easy way to make the determination is to do as ashley suggested and
write a script which does nothing other than execute the query.

-nathan
 | 
Pages: 1
Prev: PHP question
Next: calendar libs