Upper Memory Limit for PHP / Apache

I get an error when running my PHP script ....

Fatal error: Out of memory (allocated 1827405824) (tried to allocate 88800 bytes)

I added this line to my PHP script ..

ini_set("memory_limit","3000M");

This statement really controls the memory usage correctly, but I can't seem to get it above about 1.8 GB. It is as if the upper limit of memory is being limited somewhere else. I also added in php.ini ...

memory_limit = 3000M

Does anyone know if memory is limited elsewhere?

I am running a local server with Xampp. I have Windows 7, 64-bit with 4 GB of RAM. My script uses the PHP GD image library, and I get an error when trying to highlight a link to an image using ImageCreateTrueColor ().

(I know this is a huge amount of memory, but this is just one of the script, and it is much easier to do so).

Thank.

Update ....

@elusive @Orbling , , , .

<?php
    ini_set("memory_limit","4000000000");
    echo "ini_get = " . ini_get('memory_limit') . "<br>\n";
    echo "memory_get_usage = " . memory_get_usage(true) . "<br>\n";
    $bigImageHandle = imagecreatetruecolor(22200, 24800);  //this is line 5
?>

...

ini_get = 4000000000
memory_get_usage = 524288

Fatal error: Out of memory (allocated 1843396608) (tried to allocate 88800 bytes) in
E:\User\My_Webs\experiments\houseshunting\temp\osMaps\t1.php on line 5

, imagecreatetruecolor(), , 2.7

+16
8

64- , Apache PHP, , 32-. mod_php, apache .

32- 2 , /3GB, 3 .

200 MiB, , , ,

, , 2GiB ( , 4GiB 32- . 2 GiB 2GiB ).

, ? 64- PHP, (, system())

+7

Acquia Dev Desktop, .

PHP.ini.

php_value memory_limit                  1024M
php_value max_execution_time            3000

, ( Recreate)

httpd.conf StackThread 16M

ThreadStackSize 16*1024*1024

. ,

+5

set_time_limit(300);
ini_set('memory_limit', '20000M');
+1

Apache (, httpd.conf). , RLimitMEM , , .

, PHP, , Apache , .

, , . , , ... . , 1.5Gig , - ( ), - (, EC2).

:

/usr/local/apache/conf
#RLimitMEM 85643200 104857600   # Limit to: 80Mb / process, 100Mb total
RLimitMEM 134217728 537395200   # Limit to: 128Mb / Process, 512Mb total
+1

PHP ?

memory_limit 32- , 2 .

: http://bugs.php.net/bug.php?id=39132&edit=1

From the bottom comment on this bug report, it could be a subroutine that translates a human readable form into a number, try putting it in numbers.

0
source

Try the following:

#php_value memory_limit 300M 
#php_value upload_max_filesize 200M 
#php_value post_max_size 200M 
#php_value max_execution_time 80000 
#php_value max_input_time 80000   
0
source

The problem will most likely be caused by running 32-bit apache and php. Try upgrading them to 64-bit binaries and see if the problem resolves.

0
source

try ini_set('memory_limit', '-1');

-2
source

All Articles