Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP抛出';允许的内存耗尽';在Drupal中迁移数据时出错_Php_Mysql_Drupal - Fatal编程技术网

PHP抛出';允许的内存耗尽';在Drupal中迁移数据时出错

PHP抛出';允许的内存耗尽';在Drupal中迁移数据时出错,php,mysql,drupal,Php,Mysql,Drupal,我正试图在本地机器上设置一个小沙盒,与Drupal一起玩。我创建了一些CCK类型;为了创建几个节点,我编写了以下脚本: chdir('C:\..\drupal'); require_once '.\includes\bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); module_load_include('inc', 'node', 'node.pages'); $node = array('type' => 'my_ty

我正试图在本地机器上设置一个小沙盒,与Drupal一起玩。我创建了一些CCK类型;为了创建几个节点,我编写了以下脚本:

chdir('C:\..\drupal');

require_once '.\includes\bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
module_load_include('inc', 'node', 'node.pages');

$node = array('type' => 'my_type');

$link = mysql_connect(..);
mysql_select_db('my_db');

$query_bldg = '
  SELECT stuff
  FROM table
  LIMIT 10
';

$result = mysql_query($query_bldg);

while ($row = mysql_fetch_object($result)) {

 $form_state = array();

 $form_state['values']['name'] = 'admin';
 $form_state['values']['status'] = 1;
 $form_state['values']['op'] = t('Save');

 $form_state['values']['title'] = $row->val_a;
 $form_state['values']['my_field'][0]['value'] = $row->val_b;
 ## About another dozen or so of similar assignments...

 drupal_execute('node_form', $form_state, (object)$node);

}
以下是php_errors.log中的一些相关行:

[12-Jun-2010 05:02:47] PHP Notice:  Undefined index: REMOTE_ADDR in C:\..\drupal\includes\bootstrap.inc on line 1299
[12-Jun-2010 05:02:47] PHP Notice:  Undefined index: REMOTE_ADDR in C:\..\drupal\includes\bootstrap.inc on line 1299
[12-Jun-2010 05:02:47] PHP Warning:  session_start(): Cannot send session cookie - headers already sent by (output started at C:\..\drupal\includes\bootstrap.inc:1299) in C:\..\drupal\includes\bootstrap.inc on line 1143
[12-Jun-2010 05:02:47] PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent (output started at C:\..\drupal\includes\bootstrap.inc:1299) in C:\..\drupal\includes\bootstrap.inc on line 1143
[12-Jun-2010 05:02:47] PHP Warning:  Cannot modify header information - headers already sent by (output started at C:\..\drupal\includes\bootstrap.inc:1299) in C:\..\drupal\includes\bootstrap.inc on line 709
[12-Jun-2010 05:02:47] PHP Warning:  Cannot modify header information - headers already sent by (output started at C:\..\drupal\includes\bootstrap.inc:1299) in C:\..\drupal\includes\bootstrap.inc on line 710
[12-Jun-2010 05:02:47] PHP Warning:  Cannot modify header information - headers already sent by (output started at C:\..\drupal\includes\bootstrap.inc:1299) in C:\..\drupal\includes\bootstrap.inc on line 711
[12-Jun-2010 05:02:47] PHP Warning:  Cannot modify header information - headers already sent by (output started at C:\..\drupal\includes\bootstrap.inc:1299) in C:\..\drupal\includes\bootstrap.inc on line 712
[12-Jun-2010 05:02:47] PHP Notice:  Undefined index: REMOTE_ADDR in C:\..\drupal\includes\bootstrap.inc on line 1299
[12-Jun-2010 05:02:48] PHP Fatal error:  Allowed memory size of 239075328 bytes exhau   sted (tried to allocate 261904 bytes) in C:\..\drupal\includes\form.inc on line 488
[12-Jun-2010 05:03:22] PHP Fatal error:  Allowed memory size of 239075328 bytes exhausted (tried to allocate 261904 bytes) in C:\..\drupal\includes\form.inc on line 488
[12-Jun-2010 05:04:34] PHP Fatal error:  Allowed memory size of 262144 bytes exhausted (tried to allocate 261904 bytes) in Unknown on line 0
此时,php执行的任何操作都会导致上面显示的最后一个错误。在最后一个致命错误之前,我尝试增加php.ini中的内存限制值,但显然没有帮助

如何消除错误?我是否在将数据迁移到Drupal的正确路径上,还是应该直接对cck表进行操作

Windows XP
PHP 5.3.2 VC6

Apache2.2

这个“节点表单”调用到底在做什么?我猜是$form_状态数据,并从中构建了一些巨大的内存结构。这意味着:

a) 你必须增加(或消除)内存限制——Drupal正在构建一些大的东西,而你没有给它工作的空间


b) 更改节点表单内容,使其一次生成较小的块。可能每隔一段时间将输出刷新到客户端?是否保存到磁盘?

如果您试图从sql(或其他任何地方)迁移数据,您会发现自己直接导入数据相当复杂。看看这个方法:

由于您的致命错误与内存有关,请尝试分配更多内存。这是我尝试的第一件事。我不认为超过512MB是一个可行的解决方案。