1

Soon after upgrading from 4.7.17 to 4.7.19, my WordPress CiviCRM stopped running CRON jobs. No problem, I thought -- check the permissions on cli.php and sure enough, they'd been tightened. I changed them back to 0755, and assumed I was done. But even after initiating a manual run of scheduled jobs, the CRON jobs not running error came right back.

Any idea what's causing this?

18 July -- UPDATE:

While compulsively fiddling with my CRON command, the cron daemon sent me this:

<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*<br />&nbsp;+--------------------------------------------------------------------+<br />&nbsp;|&nbsp;CiviCRM&nbsp;version&nbsp;4.7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;+--------------------------------------------------------------------+<br />&nbsp;|&nbsp;Copyright&nbsp;Tech&nbsp;To&nbsp;The&nbsp;People&nbsp;http:tttp.eu&nbsp;(c)&nbsp;2008&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;+--------------------------------------------------------------------+<br />&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;CiviCRM&nbsp;is&nbsp;free&nbsp;software;&nbsp;you&nbsp;can&nbsp;copy,&nbsp;modify,&nbsp;and&nbsp;distribute&nbsp;it&nbsp;&nbsp;|<br />&nbsp;|&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;Affero&nbsp;General&nbsp;Public&nbsp;License&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;Version&nbsp;3,&nbsp;19&nbsp;November&nbsp;2007&nbsp;and&nbsp;the&nbsp;CiviCRM&nbsp;Licensing&nbsp;Exception.&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;CiviCRM&nbsp;is&nbsp;distributed&nbsp;in&nbsp;the&nbsp;hope&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;useful,&nbsp;but&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;WITHOUT&nbsp;ANY&nbsp;WARRANTY;&nbsp;without&nbsp;even&nbsp;the&nbsp;implied&nbsp;warranty&nbsp;of&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;MERCHANTABILITY&nbsp;or&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;See&nbsp;the&nbsp;GNU&nbsp;Affero&nbsp;General&nbsp;Public&nbsp;License&nbsp;for&nbsp;more&nbsp;details.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;You&nbsp;should&nbsp;have&nbsp;received&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;GNU&nbsp;Affero&nbsp;General&nbsp;Public&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;License&nbsp;and&nbsp;the&nbsp;CiviCRM&nbsp;Licensing&nbsp;Exception&nbsp;along&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;with&nbsp;this&nbsp;program;&nbsp;if&nbsp;not,&nbsp;contact&nbsp;CiviCRM&nbsp;LLC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;at&nbsp;info[AT]civicrm[DOT]org.&nbsp;If&nbsp;you&nbsp;have&nbsp;questions&nbsp;about&nbsp;the&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;GNU&nbsp;Affero&nbsp;General&nbsp;Public&nbsp;License&nbsp;or&nbsp;the&nbsp;licensing&nbsp;of&nbsp;CiviCRM,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;|&nbsp;see&nbsp;the&nbsp;CiviCRM&nbsp;license&nbsp;FAQ&nbsp;at&nbsp;http://civicrm.org/licensing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br />&nbsp;+--------------------------------------------------------------------+<br />&nbsp;*/<br /><br /><br /></span><span style="color: #007700">require_once&nbsp;</span><span style="color: #DD0000">'cli.class.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$cli&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">civicrm_Cli</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$cli</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">initialize</span><span style="color: #007700">()&nbsp;||&nbsp;die(</span><span style="color: #DD0000">'Died&nbsp;during&nbsp;initialization'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cli</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">callApi</span><span style="color: #007700">()&nbsp;||&nbsp;die(</span><span style="color: #DD0000">'Died&nbsp;during&nbsp;callApi'</span><span style="color: #007700">);<br /></span>
</span>
</code>

That's what it looked like in the email I received. Now here it is again when I don't add the code {} formatting in the wysiwyg:

<?php
/
 +--------------------------------------------------------------------+
 | CiviCRM version 4.7                                                |
 +--------------------------------------------------------------------+
 | Copyright Tech To The People http:tttp.eu (c) 2008                 |
 +--------------------------------------------------------------------+
 |                                                                    |
 | CiviCRM is free software; you can copy, modify, and distribute it  |
 | under the terms of the GNU Affero General Public License           |
 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
 |                                                                    |
 | CiviCRM is distributed in the hope that it will be useful, but     |
 | WITHOUT ANY WARRANTY; without even the implied warranty of         |
 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
 | See the GNU Affero General Public License for more details.        |
 |                                                                    |
 | You should have received a copy of the GNU Affero General Public   |
 | License and the CiviCRM Licensing Exception along                  |
 | with this program; if not, contact CiviCRM LLC                     |
 | at info[AT]civicrm[DOT]org. If you have questions about the        |
 | GNU Affero General Public License or the licensing of CiviCRM,     |
 | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
 +--------------------------------------------------------------------+
 
/


require_once 'cli.class.php';
$cli = new civicrm_Cli();
$cli->initialize() || die('Died during initialization');
$cli->callApi() || die('Died during callApi');

  • Still spinning my wheels here. Confirmed that CRON is running on the server, and appears to be starting cli.php -- but the script no longer works as expected (due to update?), and because it doesn't complete its task, there's no email sent by the CRON Daemon to tell me what may have gone wrong. So I'm running the scheduled jobs manually every day or two. Inconvenient, but for the time being it works. I've compared the contents of civicrm/civicrm/bin on the server to those on my local system, and they're identical. What else should I try? – Prónay Jun 28 '17 at 3:28
  • I've had issues with cli.php dying for two reasons: 1 - The theme throwing fatal errors. We were using PageLines, which had some issues when bootstrapped like cli.php wants to use it. You could try with a basic WP theme. 2 - make sure that the cron user has a valid entry in the uf_match table – Andrew West Jun 28 '17 at 12:25
  • Changed permissions on cli.php and cron.php from 0755 to 0644, and verified the folder containing these scripts was 0755. With permissions set as described, it seems cli.php still does not work unless triggered manually. What next? – Prónay Jun 28 '17 at 14:27
  • Just now saw your reply, Andrew -- thank you for the suggestions. I'll look at uf_match and (if that's not the culprit) I'll see if it works when the theme is running Twenty Seventeen. Soon as I've tried that, I'll report back. – Prónay Jun 28 '17 at 17:14
  • Had to put out some fires, and finally am getting back to this one. Verified the username in both CRON commands matches a valid entry in the civicrm_uf_match table. Still getting "permission denied." Activated Twenty Seventeen theme. Still getting "permission denied." Also, dunno if it's related, but lately when I run scheduled jobs manually, I get a list of subject lines from emails processed through our mail domain. When I click Back, the Civi scheduled jobs screen loads and a success message pops up. Weird. All this to say I still can't get cli.php or cron.php to behave correctly. Ideas? – Prónay Jul 18 '17 at 2:11
0

No idea why PHP cli stopped working. Purists can chastise me for copping out, but I never figured out the PHP cli problem. Instead, I toyed around with wp-cli and ultimately got that working. After testing command lines through SSH, the first glimmer of success came from wp --user=[REDACTED] --url=https://[REDACTED] --path=/[REDACTED]/ civicrm api job.execute auth=0

At this point, it was a (relatively) simple matter of discovering the specific path to wp-cli. When that specific path appeared in place of wp in the CRON job command line, I received the desired email from the cron daemon indicating the tasks had completed.

So while this may not technically answer my original question, Done is Good, and I'm not going to pursue it further unless and until my CRON jobs again cease running.

0

Mine works: Whack this in your crontab -e

00 * * * * cd /var/www/drupal && /usr/local/bin/drush --quiet civicrm-api -u 1 job.execute

  • Thanks John. Will keep that in mind if CRON malfunctions again. Still, I'm skeptical as to whether drush is the way to go within the WordPress environment. – Prónay Jul 21 '17 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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