English 中文(简体)
允许的记忆大小差错?
原标题:Allowed memory size exhausted error < how to reset?
  • 时间:2012-04-08 21:34:09
  •  标签:
  • php
  • memory

我一直在运行一个通道,在MySQL数据库中插入50 000套数据。 我的东道空间上的服务器显示这一信息:

Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 32 bytes) in /srv/www/htdocs/server/html/email.php on line 14

我知道它意味着什么,但我如何能够重新唤起所有记忆,以便再次加以利用?

注:

我不想像我的记忆那样增加我的记忆。

ini_set( memory_limit ,  -1 );

但希望完全释放。

问题回答

在大多数情况下,如果你拥有供应商的共同系统,你就无法为采购处设定记忆限制。 然后,服务器上每100人都设定较高的记忆限制,供应商就存在问题。

因此,他们给你20MB一案留下固定的面积,并且可以行使memory_limit/strong>功能。

205名总统没有这么多。 当你试图插入许多数据集时,需要一些记忆。 因此,请209715到<>。

我认为,20MB没有解决问题的真正好办法。 也许你可以尝试将某种逻辑带给数据库,并制作的存储程序

I know this is an old thread, but I found it so I think it s worth posting for others.

I came across this error whilst trying to carry out a bulk system update to a single field in every record. The records were read into an array, processed and updated back to the database. I believe the error was caused by too much data stored in the array on the server.

To get over the problem, I split the task up to handle 1000 records at a time. i.e; (Code Tested.

$r_count=1; $start_id=0; $end_id=1000;
while($r_count>0)
{ 
 $strSQL="SELECT * from spAddbook 
           WHERE id >  $start_id  AND id <=  $end_id "; 
 $result = mysql_query($strSQL, $link) or die ("Couldn t read because ".mysql_error());
 $r_count = mysql_num_rows($result);
 echo"<br>$r_count found<br>";
 if (mysql_num_rows($result))
 {
  while ($qry = mysql_fetch_array($result))
  {
   // Read the Data and carry out processing
  }    
 }
 $start_id+=1000; $end_id+=1000;
} 
echo"<br><br>All Done";

我希望这一帮助。 它为我工作。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签