From: "fyang" on
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
<?php
$n= 50000;
for($i=0;$i<$n;$i++)
{
$data[]=array("",$i,$i/1000);
echo $i," ",$data[$i][1],"<br>";
}
echo "count:",count($data);
?>
OS1: Red Hat Enterprise Linux Server release 5.1
Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux
test result: the result is correct,it can display 50000 data and
count:50000.

OS2: CentOS release 5.4
Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux
test result: the result is wrong,it can only display 31148 data and it
can not display count value.
I'm not sure the result relate to array capacity in different OS.
Please give me some tips,thanks in advance.

good luck,

Yang Fei
2010-7-20

From: "Bob McConnell" on
From: fyang

> I have a simple test code in different OS ,but it give me a
different
> result.
> the code as follows:
> <?php
> $n= 50000;
> for($i=0;$i<$n;$i++)
> {
> $data[]=array("",$i,$i/1000);
> echo $i," ",$data[$i][1],"<br>";
> }
> echo "count:",count($data);
> ?>
> OS1: Red Hat Enterprise Linux Server release 5.1
> Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux
> test result: the result is correct,it can display 50000 data and
> count:50000.
>
> OS2: CentOS release 5.4
> Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux
> test result: the result is wrong,it can only display 31148 data and
it
> can not display count value.
> I'm not sure the result relate to array capacity in different OS.
> Please give me some tips,thanks in advance.

Did you really have to post the same message eight times?

CentOS is Red Hat minus the proprietary elements, so you actually have
two releases of the same OS here. The bigger question is what version of
PHP are you running on each of them and how are they configured?

Bob McConnell
From: "fyang" on
Dear Bob McConnell,
Thank you for your reply.
I really post the same message eight times because of the first e-mail authentication.please remove the extra e-mail in your free time.
There are two servers ,the first installation of 32-bit linux(RHEL),the second installlation 64-bit linux(CENTOS).
PHP version on 32-bit linux(RHEL):5.2.7
PHP version on 64-bit linux(CENTOS):5.2.13
I found this problem,because the software transplantation.In the 64-bit systems,the array seems to always have limited capacity. I'm not sure that is php version problem or need other configurations.
Please give further guidance, thank you very much!


best wishs,

Yang Fei
2010-7-22








·¢¼þÈË£º Bob McConnell
·¢ËÍʱ¼ä£º 2010-07-21 20:06:36
ÊÕ¼þÈË£º fyang; php-general(a)lists.php.net
³­ËÍ£º
Ö÷Ì⣺ RE: [PHP] php array in different OS

From: fyang

> I have a simple test code in different OS ,but it give me a
different
> result.
> the code as follows:
> <?php
> $n= 50000;
> for($i=0;$i <$n;$i++)
> {
> $data[]=array("",$i,$i/1000);
> echo $i," ",$data[$i][1]," <br >";
> }
> echo "count:",count($data);
> ? >
> OS1: Red Hat Enterprise Linux Server release 5.1
> Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux
> test result: the result is correct,it can display 50000 data and
> count:50000.
>
> OS2: CentOS release 5.4
> Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux
> test result: the result is wrong,it can only display 31148 data and
it
> can not display count value.
> I'm not sure the result relate to array capacity in different OS.
> Please give me some tips,thanks in advance.

Did you really have to post the same message eight times?

CentOS is Red Hat minus the proprietary elements, so you actually have
two releases of the same OS here. The bigger question is what version of
PHP are you running on each of them and how are they configured?

Bob McConnell
From: Colin Guthrie on
'Twas brillig, and fyang at 22/07/10 03:34 did gyre and gimble:
> Dear Bob McConnell,
> Thank you for your reply.
> I really post the same message eight times because of the first e-mail authentication.please remove the extra e-mail in your free time.
> There are two servers ,the first installation of 32-bit linux(RHEL),the second installlation 64-bit linux(CENTOS).
> PHP version on 32-bit linux(RHEL):5.2.7
> PHP version on 64-bit linux(CENTOS):5.2.13
> I found this problem,because the software transplantation.In the 64-bit systems,the array seems to always have limited capacity. I'm not sure that is php version problem or need other configurations.

I suspect it's just different configuration.

That said, I've generally found that 64bit versions of PHP need more
memory than their 32bit equivs, so perhaps all you need to do is
something like:

ini_set('memory_limit', '50M');

and you'll be fine.

Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]

From: "Yang Fei" on
Dear Colin Guthrie ,

Thanks for your help very much.
According to your suggestion, I have solved the question.

best wish,
Yang Fei
2010-7-24