Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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..?

share|improve this question

migrated from Mar 13 '11 at 19:45

This question came from our site for professional and enthusiast programmers.

what is output of ulimit -v – Zimbabao Mar 12 '11 at 9:56

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'); ?>
share|improve this answer
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 '11 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 – Mar 12 '11 at 11:07

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.