Search code examples
phpphpstormphp-builtin-server

Does the PHP Built-in Webserver have a memory limit?


I am locally hosting PHP scripts in PhpStorm using the "PHP Built-in Web Server" configuration. One script needs much memory, so I added ini_set('memory_limit', 8589934592); # 8GiB at the beginning of it (Setting it works, I checked it with ini_get('memory_limit')).

But when I request the referring url, the execution of the script fails with the following error message in the error log:

PHP Fatal error: Out of memory (allocated 1793064960) (tried to allocate 8334 bytes) in ...

It is only able to allocate about 1.7GiB.

Does anybody know, why this happens? I assume that the PHP Built-in Webserver has a memory limit, but I cannot find anything about that.


PS: I'm using PHP v5.6, Windows 8 and PhpStorm 10.0.3


Edit: My PC has about 10Gib free RAM to use


Solution

  • Do you run the webserver in 32 bit? If so, it might only be allowed to use max. 2 GB: How much memory can a 32 bit process access on a 64 bit operating system?

    I think you can check this with the PHP_INT_SIZE constant: Checking if your code is running on 64-bit PHP