Answers.Body: <p>So CLI's memory limit was set to -1 like this:</p>
  
  <pre><code>memory_limit = -1 // no memory limit
  </code></pre>
  
  <p>Setting the limit to other than <strong><em>no limit</em></strong> solved the issue.</p>
  
  <p>I'm not sure why this happened as CLI's memory limit was always set to <strong><em>-1</em></strong> from the very first day I configured this server 2 years ago.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-15T10:48:54.603Z
Answers.LastActivityDate: 2016-05-15T10:48:54.603Z
Answers.UserDisplayName: Andrei
Body: <p>Platform: Wordpress 4.5.2 |
  PHP version: 5.5.9 |
  Mysql: 5.6.30 |
  Running: Ubuntu 14.04.4</p>
  
  <p>Yesterday I successfully upgraded to CiviCRM 4.6.16, no errors during upgrade, everything went smoothly, except the cron job is failing with the next error:</p>
  
  <pre><code>PHP Fatal error:  
    Allowed memory size of 262144 bytes exhausted (tried to allocate 1920 bytes) in
    /var/www/site/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.class.php
    on line 226
  </code></pre>
  
  <p>PHP memory limit is set to 512M</p>
  
  <p><a href="https://github.com/civicrm/civicrm-core/blob/4.6.16/bin/cli.class.php#L226" rel="nofollow">line 226 at civicrm/bin/cli.class.php</a></p>
  
  <p>The cron job runs every 5 minutes and looks like this:</p>
  
  <pre><code>php /var/www/site/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute
  </code></pre>
  
  <p>If I run the job from the API explorer, it runs successfully with no errors, it also runs successfully if I execute a job with <strong>Execute now</strong> in the <strong>Scheduled jobs</strong> page.</p>
  
  <p>Any input is highly appreciated.</p>
  
Tags: <wordpress><cron-job><cron>
Title: Cron failing after 4.6.16 upgrade
ThreadText: # Cron failing after 4.6.16 upgrade
  
  (Asked by: username_0 on 2016-05-12)
  
  Platform: Wordpress 4.5.2 |
  PHP version: 5.5.9 |
  Mysql: 5.6.30 |
  Running: Ubuntu 14.04.4
  
  Yesterday I successfully upgraded to CiviCRM 4.6.16, no errors during upgrade, everything went smoothly, except the cron job is failing with the next error:
  
  ```
  PHP Fatal error:  
    Allowed memory size of 262144 bytes exhausted (tried to allocate 1920 bytes) in
    /var/www/site/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.class.php
    on line 226
  
  ```
  
  PHP memory limit is set to 512M
  
  [line 226 at civicrm/bin/cli.class.php](https://github.com/civicrm/civicrm-core/blob/4.6.16/bin/cli.class.php#L226)
  
  The cron job runs every 5 minutes and looks like this:
  
  ```
  php /var/www/site/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute
  
  ```
  
  If I run the job from the API explorer, it runs successfully with no errors, it also runs successfully if I execute a job with **Execute now** in the **Scheduled jobs** page.
  
  Any input is highly appreciated.
  
  **Tags:** wordpress, cron-job, cron
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-05-15. Score: 2 | Accepted answer
  
  So CLI's memory limit was set to -1 like this:
  
  ```
  memory_limit = -1 // no memory limit
  
  ```
  
  Setting the limit to other than ***no limit*** solved the issue.
  
  I'm not sure why this happened as CLI's memory limit was always set to ***-1*** from the very first day I configured this server 2 years ago.
  
  
  ---
  
  