在Drupal迁移数据时,PHP会抛出“允许的内存耗尽”错误 [英] PHP throws 'Allowed memory exhausted' errors while migrating data in Drupal

查看:174
本文介绍了在Drupal迁移数据时,PHP会抛出“允许的内存耗尽”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to setup a tiny sandbox on a local machine to play around with Drupal. I created a few CCK types; in order to create a few nodes I wrote the following script:

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中的几条相关行: / p>

Here are a few relevant lines from 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中的memory_limit的值,这显然没有帮助。

At this point any action php takes results in the last error shown above. I tried increasing the value of memory_limit in php.ini before the final Fatal error which obviously didn't help.

如何消除错误?我正在将数据迁移到Drupal的正确路径,还是直接运行cck表?

How can the error be eliminated? Am I on a correct path to migrating data into Drupal or should the cck tables be operated on directly?

Windows XP

PHP 5.3.2 VC6

Apache 2.2

Windows XP
PHP 5.3.2 VC6
Apache 2.2

推荐答案

如果您尝试从sql(或其他任何地方)迁移数据,你会发现做自己的直接导入是相当复杂的。看看这个方法:
http ://www.lullabot.com/articles/drupal-data-imports-migrate-and-table-wizard

If you're trying to migrate data from sql (or anywhere else), you'll find doing your own direct import is fairly complicated. Have a look at this method: http://www.lullabot.com/articles/drupal-data-imports-migrate-and-table-wizard

这篇关于在Drupal迁移数据时,PHP会抛出“允许的内存耗尽”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆