Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com Mar 13 '11 at 19:45

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

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

2 Answers 2

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 codingforums.com/archive/index.php/t-206304.html –  ipim.com 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

 
discard

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