1

I have a big php script that needs a gigabyte or more to run. I set the memory_limit in php.ini to 2048M. If I echo the limit with ini_get, I get the 2048M as expected. But when I run the script it fails and says that it could only allocate 512mb. I have 16GB of ram on the server, so its not that. There must be another limit set somewhere..?

1
  • 2
    what is output of ulimit -v
    – Zimbabao
    Mar 12, 2011 at 9:56

2 Answers 2

1

PHP, Webserver processes are also limited by the per process max memory limit. You'll have to ask an administrator to change the limit in this case. On linux/unix, you can check the limit with the following command in the shell:

ulimit -a

or use PHP to check:

<?php print system('ulimit -a'); ?>
2
  • This is what i get: core file size (blocks, -c) 0 data seg size (kbytes, -d) 6144 file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 256 pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 266 virtual memory (kbytes, -v) unlimited virtual memory (kbytes, -v) unlimited
    – Pontus Uggla
    Mar 12, 2011 at 10:36
  • Hi, try RLimitMEM in your httpd.conf to set memory limit of Apache children processes. This guy seems to have the same problem of yours codingforums.com/archive/index.php/t-206304.html
    – ngduc
    Mar 12, 2011 at 11:07
0

Don't know about any apache limits but I do know Linux supports setting resource limits for processes. Can't remember the exact details but one command involved is ulimit.

You must log in to answer this question.