Re: [PHP-WEBMASTER] Problems using PHP regarding the amount of memory I can use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 23, 2012 at 8:47 PM, Alfredo Ricardo de Faria Passos <
alfredorp33@xxxxxxxxxxxx> wrote:

> Thank you for your help Ferenc.
>
> The thing is: the system I developed is running on a windows 7 ultimate,
> 64 bits. The system is composed of:
>
> - a Code made of php language
> - A Postgre SQL database (version 5.4.4)
> - An EMS SQL Manager Lite
> - An Apache 2.2.9 server (the Apache server, as long as I know only exists
> in 32 bit version for windows).
>

there is no official 64bit binaries, but there are a few other sources,
where you can get pre-compiled 64bit binaries (
http://www.apachelounge.com/download/win64/ for example) or you can compile
it yourself.


>
> Initially we were receiving a message stating that the allocated amount of
> memory (1024 MB) was reached.
>
> We chanced the amount of memory in the "Memory" section on php.ini. We put
> on this section a memory of 6GB (wich is the amount of free memory we would
> like php to use to perform our algorithms).
>
> We were able to perform the task with the data we have at hands. But,
> increasing the amount of data we got a new error message regarding memory
> (this time stating a memory amount around 2GB).
>
> We don't know if this is a limitation of php or Apache Server (or both).
>

32bit applications usually can't allocated more than 2GB memory (with 4GT
you can raise that per process memory limit to 3GB and with PAE, you can
raise the system wide 4GB limit, see
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366796(v=vs.85).aspx
 )
if you need more than that, you have to use a 64bit version of PHP.
that isn't officially supported, but you can either try to compile
yourself, or you can try downloading from unofficial sources ( like
http://www.anindya.com/ ) or there are a few wamp packages offering
complete 64 bit stack.

for the record: if you plan to use apache + mod_php5, both apache and php
has to be 64bit binaries, but if you use cgi/fastcgi then only your php
binary has to be 64bit, as it will be a separate process in this case.


>
> We need to perform our tasks with as much data we can add (as as a
> consequence, with all the memory we have).
>
> Can you tell me if php language is limited to perform tasks with the
> amount of data a 32 bit software can recognize or can I use the code to
> perform tasks using all the memory we can install (in my case up to 16 GB)?
>

you can use more than 2GB memory, however you can still run into some
issues, for example

The root problem is that Windows "WIN64" is a 64P architecture.  Linux and
> *nix variants, on the other hand, are 64ILP or 64LP.  Meaning Windows has
> longs/ints which are undersized compared to the *nix brethren.  The old and
> stale abuse such as unsigned long X = (unsigned long)pY; will not do what
> the author intended.
>
> This means all packages ported to *nix 64 bits may have very serious flaws
> which have not been fixed for *Windows 64 bit* architecture.


so you can't have longs/ints larger than 2147483647, which means for
example than you can have problems handling files over the size of 2GB:
https://bugs.php.net/bug.php?id=48886

Also, regarding Apache server, can you tell me if is there any way we could
> expand its ability to use all this memory? If not I think my only way is to
> change the system to use My SQL 64 bits (vbut again, I need to confirm if
> php can use all the memory acessible to 64 bits systems).
>

migrating from postgres to mysql wouldn't change the situation, you need a
64-bit php binary to be able to use more than 2(3 with the 4GT option) GB
memory

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux