开发者

Does PHP have an inherent memory limit, beyond what I set?

开发者 https://www.devze.com 2023-01-08 07:49 出处:网络
Does PHP have a built-in limitation on how much memory it can use? In other words, if I have a machine with many gigs of RAM and change php.ini to allocate most of them, will scripts still hit some开发

Does PHP have a built-in limitation on how much memory it can use? In other words, if I have a machine with many gigs of RAM and change php.ini to allocate most of them, will scripts still hit some开发者_开发知识库 lower limit?

(If you're curious, the goal is to run an automatic documentation generator, written in PHP, on a very large PHP code base.)


PHP will consume as much as it has, this depends on your operating system. You can not extend the memory limit of PHP beyond what your OS has to offer.


Apart from the PHP ini directive memory_limit you are only bound by the machine's available RAM. Note that memory_limit is per script, so running multiple scripts at the same time can eventuall sum to more memory than you server has.


The maximum amount of memory per process can also be limited by the operating system and/or some configurable resource limits.

E.g. on a windows system a 32bit process is limited to 2/3/4 GB memory per process (depending on whether you use a 64bit version of windows and the setting of IMAGE_FILE_LARGE_ADDRESS_AWARE). A 64bit process might be limited to 2GB as well (with IMAGE_FILE_LARGE_ADDRESS_AWARE cleared).
On a linux system there are similar restrictions and often limits set via ulimit.

0

精彩评论

暂无评论...
验证码 换一张
取 消