I have a script that saving the hundreds or thousands of nodes at one time and It is nearly impossible to manage it with Batch API. When I am running my script it saying :

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16 bytes) in /home/staging-uls/www/sites/all/modules/token/token.module on line 461.

I set the memory using ini_set('memory_limit','256M'). My script is still so long that showing the error. Is there any other way to do so?

What my script is doing exactly:

  1. It fetches a data from other site using cUrl. The data are articles, journals and some other user's data.
  2. After getting the data in XML format, it adds each content.
  • If you could add EXACTLY what your script is trying to do, perhaps along with some code then it'd be easier to help. Also, where are you using ini_set(..), as your previous question suggests you couldn't add this anywhere where it would work.
    – Chapabu
    Dec 20, 2012 at 9:47
  • @Chapabu I talked to my client after that I set it. I set it in starting of menu's page calback function. I am updating my question with requirement. Dec 20, 2012 at 9:51
  • Is there a specific reason why you wouldn't want to use the Batch API considering that it was built to meet this exact use-case? Dec 20, 2012 at 10:06
  • @AmarnathRavikumar How will I manage the data coming from Curl Request using Batch API. Each time my script runs It fetches the data for Different Researcher. I have a content type of Researcher. Dec 20, 2012 at 10:09
  • This question is off-topic, as it is asking how to increase the memory assigned to PHP, which is not a Drupal setting. The way of increasing the memory assigned to PHP doesn't change if you use Drupal, WordPress, Joomla, or plain PHP.
    – apaderno
    Feb 13, 2013 at 6:57

1 Answer 1


I increased the max_execution_time to unlimited and I used output buffering for keep my script in progress. Change the memory limit to 1024M. I got it from This URL.

  • 1gb is pretty huge
    – GoodSp33d
    Feb 13, 2013 at 5:58
  • @2-Stroker yeah. I thought maybe the problem was due to memory limit, but it was not. Feb 13, 2013 at 6:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.