Answers.Body: <p>Just to record for others getting this error when adding Locales, I ran into this on Step 1 when ResaveElements for Assets. Seems that there were some entries in craft_assetfiles that no longer existed and caused the task to halt.</p>
  
  <p>Managed to debug by checking the step number in craft_tasks, then looking for a row at that position in assetfiles that equated to a missing file. Removed a couple of these rows and the task completed fine.</p>
  
  <p>I had Cleared Caches and Updated Indexes before starting, but seems there are still a few bad entries in the files table</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-09T19:51:15.283Z
Answers.LastActivityDate: 2017-03-09T19:51:15.283Z
Answers.UserDisplayName: Ant Cooper
Answers.Body: <p>You probably need to up <a href="https://craftcms.com/docs/config-settings#phpMaxMemoryLimit" rel="noreferrer">Craft's internal memory limit</a>, as well – the following should go into the array in your <code>general.php</code> configuration file:</p>
  
  <pre><code>'phpMaxMemoryLimit' =&gt; '1024M',
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-12T07:10:37.693Z
Answers.Text: Did everything in php.ini but that was the missing step!
Answers.UserDisplayName: biko
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-12T11:50:06.143Z
Answers.LastActivityDate: 2016-08-12T11:50:06.143Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I've looked at every option I can think of so hoping that someone can assist. We're on a dedicated server with full root access.</p>
  
  <p>We've got a relatively small site that now needs a Spanish locale adding. When I go to add it, everything seems to be smooth running until 'ResaveAllElements - step 3' and 'ResaveElements - step 99 (sometimes around 94 ish too). </p>
  
  <p>First thing I checked was the error log and found:</p>
  
  <pre><code>Allowed memory size of 268435456 bytes exhausted (tried to allocate 79 bytes)
  </code></pre>
  
  <p>So, I then changed this to 1024M - no joy. Changed it to -1 and still get exactly the same issue. These settings are reflected in the phpinfo too so they seem to be in place.</p>
  
  <p>I then phoned our server company and ran it by them who suggested placing .user.ini files in there to be sure and so we've done that and now we're at a loss. </p>
  
  <p>I found another post on here with a similar issue where the suggestion was to examine the craft.log - did that and found:</p>
  
  <pre><code>WHERE (lft = 1) AND (status = :status). Bound with :status='running') 2016/08/12 09:36:53 [trace] [system.CModule] Loading "components" application component in /*/craft/app/etc/web/WebApp.php (593) in /*/craft/app/models/TaskModel.php (81) in /*/craft/app/models/TaskModel.php (39)
  </code></pre>
  
  <p>Is there anything else we can try to get the locale that we've missed?</p>
  
  <p>Any help would much appreciated.</p>
  
  <p>Thanks!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-12T10:59:26.237Z
Comments.Text: Did you up [Craft's internal memory limit](https://craftcms.com/docs/config-settings#phpMaxMemoryLimit), as well?
Comments.UserDisplayName: Mats Mikkel Rummelhoff
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-12T11:14:27.723Z
Comments.Text: Perfect!! Completely missed that. Sorted, now just got a 'Resaving supertable blocks' failure when creating the locale. I'll create another post for that as it appears a separate issue.
Comments.UserDisplayName: JonnyT
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-12T11:48:04.620Z
Comments.Text: That's great, @JonnyT – I'll add that as an answer, then :)
Comments.UserDisplayName: Mats Mikkel Rummelhoff
Tags: <localization><php><memory>
Title: Adding new locale - hangs at Step 3 'ResaveAllElements'
ThreadText: # Adding new locale - hangs at Step 3 'ResaveAllElements'
  
  (Asked by: username_0 on 2016-08-12)
  
  I've looked at every option I can think of so hoping that someone can assist. We're on a dedicated server with full root access.
  
  We've got a relatively small site that now needs a Spanish locale adding. When I go to add it, everything seems to be smooth running until 'ResaveAllElements - step 3' and 'ResaveElements - step 99 (sometimes around 94 ish too).
  
  First thing I checked was the error log and found:
  
  ```
  Allowed memory size of 268435456 bytes exhausted (tried to allocate 79 bytes)
  
  ```
  
  So, I then changed this to 1024M - no joy. Changed it to -1 and still get exactly the same issue. These settings are reflected in the phpinfo too so they seem to be in place.
  
  I then phoned our server company and ran it by them who suggested placing .user.ini files in there to be sure and so we've done that and now we're at a loss.
  
  I found another post on here with a similar issue where the suggestion was to examine the craft.log - did that and found:
  
  ```
  WHERE (lft = 1) AND (status = :status). Bound with :status='running') 2016/08/12 09:36:53 [trace] [system.CModule] Loading "components" application component in /*/craft/app/etc/web/WebApp.php (593) in /*/craft/app/models/TaskModel.php (81) in /*/craft/app/models/TaskModel.php (39)
  
  ```
  
  Is there anything else we can try to get the locale that we've missed?
  
  Any help would much appreciated.
  
  Thanks!
  
  **Tags:** localization, php, memory
  
  > **Comments:**
  > **username_1**: Did you up [Craft's internal memory limit](https://craftcms.com/docs/config-settings#phpMaxMemoryLimit), as well?  
  > **username_0**: Perfect!! Completely missed that. Sorted, now just got a 'Resaving supertable blocks' failure when creating the locale. I'll create another post for that as it appears a separate issue.  
  > **username_1**: That's great, @username_0 – I'll add that as an answer, then :)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-08-12. Score: 6 | Accepted answer
  
  You probably need to up [Craft's internal memory limit](https://craftcms.com/docs/config-settings#phpMaxMemoryLimit), as well – the following should go into the array in your `general.php` configuration file:
  
  ```
  'phpMaxMemoryLimit' => '1024M',
  
  ```
  
  > **Comments:**
  > **username_3**: Did everything in php.ini but that was the missing step!  
  
  ---
  
  ### Answer by username_2 on 2017-03-09. Score: 1
  
  Just to record for others getting this error when adding Locales, I ran into this on Step 1 when ResaveElements for Assets. Seems that there were some entries in craft\_assetfiles that no longer existed and caused the task to halt.
  
  Managed to debug by checking the step number in craft\_tasks, then looking for a row at that position in assetfiles that equated to a missing file. Removed a couple of these rows and the task completed fine.
  
  I had Cleared Caches and Updated Indexes before starting, but seems there are still a few bad entries in the files table
  
  
  ---
  
  