Hello fellow developers,

I've written a php script that scans through LOADS of folders and files and generates a word document with tables that list files and folders if they match certain criteria. I am running the script via command line on a Windows box.

I have set the memory_limit parameter in php.ini to -1 AND I have hard coded ini_set('memory_limit', '-1') into the script so that there is no possible way for PHP to run out of memory (right?).

However, I am still getting the following error:

Fatal error: Out of memory (allocated X) (tried to allocated Y bytes) in file...

I'm starting to suspect that the problem is occurring because windows is not allocating enough RAM to PHP. To find out how much memory the server has and how much is being allocated to PHP from windows, I added the following lines of code to my script:

PHP Code:
//output total RAM for the windows box
exec('wmic memorychip get capacity'$totalMemory);
echo 
array_sum($totalMemory);
//output = 4294967296 (4GB)

//memory allocated to PHP from windows
echo memory_get_usage();
//output = 384848 (approx. 376KB) 
Is the reason why I am still getting the "Out of memory" error because windows is not allowing PHP enough RAM? If so, does anyone know how to increase the memory that PHP is allowed to use?

Please help and thank you!!!

Chris