4

We are creating a mailing and trying to track click-throughs. When 'Track Click-Throughs' is enabled, clicking on any of the links results in a URL like this: https://mysite.org/sites/all/modules/contrib/civicrm/extern/url.php?u=55&qid=2261 and does not go to the link itself. This is what shows on screen:

Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /mysite.org/sites/all/modules/contrib/civicrm/CRM/Mailing/Event/BAO/TrackableURLOpen.php on line 92

Warning: Cannot modify header information - headers already sent by (output started at /mysite.org/sites/all/modules/contrib/civicrm/CRM/Mailing/Event/BAO/TrackableURLOpen.php:92) in /mysite.org/sites/all/modules/contrib/civicrm/CRM/Utils/System.php on line 423

If I do not enable Trackable Click Throughs, then the links work. It appears to be two different issues, but I'm not sure how to resolve either, and if fixing one will take care of the other.

I'm on Drupal 7.38 and Civi 4.5.8.

I've doubled checked civicrm.settings.php (per CiviMail Tracked URLs) and my BaseURL is

define( 'CIVICRM_UF_BASEURL' , 'https://mysite.org/' );

I've looked at the links in civicrm_mailing_trackable_url in my database and at the permissions of civicrm/extern/url.php (per Why do track click through). The links look correct and the permissions of url.php are 644.

Any help or direction on either of the warnings is greatly appreciated!

4

I had this problem crop up when my web host upgraded their version of PHP and the new site-wide php.ini that they installed did not have the timezone set correctly.

You can correct this in the .htaccess file that is located at the root of your web site. In that file, put these lines:

<IfModule mod_php5.c> php_value date.timezone "America/New_York" </IfModule>

Your .htaccess file might already have an <IfModule mod_php5.c> block, in which case you can just put the php_value date.timezone "America/New_York" line in that existing block.

And of course, if you aren't in the eastern time zone, pick the time zone that is appropriate for you.

Hope this helps - it resolved everything for me.

Richard

  • Thank you Richard! Fixing the timezone issue made the links work when tracking is enabled. – Allen Hutchison Jun 29 '15 at 3:07
5

Richard's answer is correct. While this seems unrelated, look at this answer for an explanation of what's happening here, except instead of a PDF header, it's redirect code. You're getting an unrelated warning, and you can't send a warning and then send a redirect header. In fact, I'm guessing that you can't currently generate PDFs right now either. Fixing the "unrelated" warning will fix this problem, and the problem is that your webhost hasn't defined a timezone for PHP.

Note that Richard's answer is only one way to set a PHP setting, and doesn't work if your webhost disallows it. I would take up with your webhost the best way to resolve this. Another way that works in almost any environment is to use an ini_set command anywhere in your civicrm.settings.php file.

  • 1
    Thank you, Jon. I appreciate you explaining the full reason it wasn't working. And for showing the use of the ini_set command for civicrm.setting.php. – Allen Hutchison Jun 29 '15 at 3:08

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.