1

Running CiviCRM 4.7 on WordPress 4.7.3, hosted on a shared Linux server at 1and1.com. The WordPress site is using PHP 7.0 but apparently the latest version I can use from the command line is 5.5.

Two problems (perhaps related?)

The system status screen says "Cron not running". Cron is running. I currently have crontab sending me an email every 15 minutes using the cronTest.php file which contains this:

<?php mail('[email protected]','Cron Job Test Script',phpversion()); ?>

That is working, sending me the email and reporting PHP version 5.5.38.

I'm also trying to use cli.php to execute the CiviCRM Job, but that doesn't seem to be working.

Here's my whole crontab (with sensitive info changed):

*/15 * * * * /usr/bin/php5.5 /mysharedserver/homepages/34/d11111111/htdocs/cronTest.php
*/15 * * * * /usr/bin/php5.5 /mysharedserver/homepages/34/d11111111/htdocs/mysubdir/wp-content/plugins/civicrm/civicrm/bin/cli.php -s mydomain.org -u cronuser -p cronuserpassword -e Job -a execute

I have also tried wget in crontab without success:

0 * * * * wget -O - -q -t 1 'http://mydomain.org/wp-content/plugins/civicrm/civicrm/bin/cron.php'?name=cronuser&pass=cronuserpassword@&key=mysitekey

I also tried wget with the single quote after the site key.

The timestamp error in CiviCRM system status says:

Timestamps reported by MySQL (eg "2017-04-11 14:58") and PHP (eg "2017-04-11 18:58" ) are mismatched

I have checked the PHP time using date_default_timezone_get() in the folder where WordPress is installed, and using SQL CURTIME() and CURDATE(), the times and dates match -- both show the time and date in New York. I have also created a php.ini in the directory where WordPress is running, with a directive setting the time to America/New York:

date.timezone = "America/New_York"

So CiviCRM must be getting its PHP time somewhere other than in the directory where WordPress is installed? I thought maybe that would be the directory where PHP 5.5 is running, so I tried running the PHP function date_default_timezone_get() in /usr/bin/php5.5 and got:

X-Powered-By: PHP/5.5.38 Content-type: text/html date_default_timezone_set: America/New_York

Using this SQL command:

SELECT @@global.time_zone, @@session.time_zone

I get SYSTEM for both values. I haven't pursued the SQL question any further than that, since the SQL time seems correct (New York time).

I'm looks to me like the PHP time is the problem, but I'm not sure where to go from here.

1
  • Welcome! Although these both relate to your new installation this would be better asked as two separate questions, maybe with a link in each to the other.
    – Aidan
    Commented Apr 11, 2017 at 20:25

1 Answer 1

1

The first thing I would check is the TimeZone setting in WP. Go to Settings--> General. That cannot be the default (UTC +0) as the default does not exist in php (UTC does, but not UTC +0). That should solve the TZ mismatch. Best to use one of these - http://php.net/manual/en/timezones.america.php for NY I'd use America/New_York

As far as cron, I recommend that you set it using the wp-cli method as detailed here: https://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs

2
  • Timestamp suggestion worked. Thank you! Still working on wp-cli. Tried to include additional questions in my original question but not sure if you could see it, so left my questions as a separate answer, too. Any help will be greatly appreciated. Commented Apr 12, 2017 at 0:13
  • Have put my wp-cli questions in a new post: civicrm.stackexchange.com/questions/18119/… Commented Apr 12, 2017 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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