简体   繁体   English

致命错误-允许的内存-PHP

[英]Fatal Error - Allowed Memory - PHP

This is my code: 这是我的代码:

    <?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 '</br>';
    include("email_gerente_conta.php");
 }

 ?>

And it works very well in my browser : http://174.30.255.100:88/call_email_gerente_conta.php 它在我的浏览器中效果很好: http : //174.30.255.100 : 88/call_email_gerente_conta.php

but if i do this in my cdm: 但是如果我在cdm中这样做:

"C:\\Program Files (x86)\\iis\\PHP\\v5.6\\php.exe" E:\\site\\call_email_gerente_conta.php “ 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 E:\\site\\call_email_gerente_conta.php on line 8 我收到此错误消息:致命错误:在第8行的E:\\ site \\ call_email_gerente_conta.php中,耗尽了134217728字节的允许内存大小(尝试分配36字节)

I already tried increase memory to 128m, 512 and 1g, but still crashing, i'll avoid to use "-d memory_limit=-1", this error message refers to my loop, but i dont understant why this works fine on my browser and not in my cmd, and why a code quite simple and with a csv that has only 3 lines, need this much of memory Any help please 我已经尝试将内存增加到128m,512和1g,但是仍然崩溃,我将避免使用“ -d memory_limit = -1”,该错误消息是指我的循环,但是我不明白为什么这在我的浏览器上可以正常工作而不是在我的cmd中,以及为什么一个代码非常简单且具有仅3行的csv的代码,需要这么多的内存,请帮忙

You need to change php.ini . 您需要更改php.ini

And change number of allowed space. 并更改允许的空间数量。

Link is here 链接在这里

If you have access to specify server (Ubuntu or Windows) You need to change specify file in Apache/conf or php/conf 如果您有权指定服务器(Ubuntu或Windows),则需要在Apache / confphp / conf中更改指定文件

It can be here or here 可以在这里这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM