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.