Fatal Error in CMD with PHP

Hi everyone my first post so, sorry if i did something wrong.

This is my code:

[php]

<?php $file = fopen('Lista_responsaveis.csv', 'r'); $i=0; while (($line = fgetcsv($file)) !== FALSE) { $responsavel[$i]=$line[0]; $i++; } fclose($file); unset($responsavel[0]); foreach ($responsavel as $item) { echo ''; include("email_gerente_conta.php"); } ?>

[/php]

And it works very well in my browser : http://174.30.255.100:88/call_email_gerente_conta.php

but if i do this in my cdm:

“C:\Program Files (x86)\iis\PHP\v5.6\php.exe” E:\site\call_email_gerente_conta.php

I get this error message: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate
36 bytes) in D:\site\call_email_gerente_conta.php on line 8

Any idea why this works on browser and not on my cmd?

Thanks

PHP and PHP cli have different config files so you might have different values for max memory

Is the file very large?

Hi JimL,

I understand, but the message says that allowed memory size of 134217728 bytes for a 36 bytes and my csv has only 3 lines

For me is very strange, because it seems me that i have enough memory for that

Add a print statement into the while loop. If it is running out of memory, it is likely looping more than just for those 3 lines.

I figure out and solve the problem. The Path on CMD are not the same for the browser, i change to right path and fix

Thank you all

Sponsor our Newsletter | Privacy Policy | Terms of Service