Answers.Body: <p>Richard's answer is correct.  While this seems unrelated, look at <a href="https://civicrm.stackexchange.com/questions/2555/error-when-printing-pdf-letter-or-mailing-label-from-search-results-list/2560#2560">this answer</a> 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.</p>
  
  <p>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 <a href="http://www.electrictoolbox.com/php-change-timezone/" rel="nofollow noreferrer">use an ini_set command</a> anywhere in your civicrm.settings.php file.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-29T03:08:23.443Z
Answers.Text: 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.
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-28T22:22:01.437Z
Answers.LastActivityDate: 2015-06-28T22:22:01.437Z
Answers.LastEditDate: 2017-04-13T12:53:13.167Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>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.</p>
  
  <p>You can correct this in the .htaccess file that is located at the root of your web site.  In that file, put these lines:</p>
  
  <p><code>&lt;IfModule mod_php5.c&gt;
  php_value date.timezone "America/New_York"
  &lt;/IfModule&gt;</code></p>
  
  <p>Your .htaccess file might already have an <code>&lt;IfModule mod_php5.c&gt;</code> block, in which case you can just put the <code>php_value date.timezone "America/New_York"</code> line in that existing block.</p>
  
  <p>And of course, if you aren't in the eastern time zone, pick the time zone that is appropriate for you.</p>
  
  <p>Hope this helps - it resolved everything for me.</p>
  
  <p>Richard</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-29T03:07:26.923Z
Answers.Text: Thank you Richard!  Fixing the timezone issue made the links work when tracking is enabled.
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-28T17:08:44.207Z
Answers.LastActivityDate: 2015-06-28T17:08:44.207Z
Answers.UserDisplayName: richardsplayground
Body: <p>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: <a href="https://mysite.org/sites/all/modules/contrib/civicrm/extern/url.php?u=55&amp;qid=2261" rel="nofollow noreferrer">https://mysite.org/sites/all/modules/contrib/civicrm/extern/url.php?u=55&amp;qid=2261</a> and does not go to the link itself.  This is what shows on screen:</p>
  
  <blockquote>
    <p>Warning: date(): It is not safe to rely on the system's timezone
    settings. You are <em>required</em> 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</p>
    
    <p>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</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>I'm on Drupal 7.38 and Civi 4.5.8.</p>
  
  <p>I've doubled checked civicrm.settings.php (per <a href="https://civicrm.stackexchange.com/questions/3279/civimail-tracked-urls-give-missing-input-parameters-from-extern-url-php">CiviMail Tracked URLs</a>) and my BaseURL is </p>
  
  <blockquote>
    <p>define( 'CIVICRM_UF_BASEURL'      , '<a href="https://mysite.org/" rel="nofollow noreferrer">https://mysite.org/</a>' );</p>
  </blockquote>
  
  <p>I've looked at the links in civicrm_mailing_trackable_url in my database and at the permissions of civicrm/extern/url.php (per <a href="https://civicrm.stackexchange.com/questions/2421/why-do-track-click-through-links-not-redirect-to-correct-address">Why do track click through</a>).  The links look correct and the permissions of url.php are 644.</p>
  
  <p>Any help or direction on either of the warnings is greatly appreciated!</p>
  
Tags: <civimail>
Title: CiviMail - when Track Click Throughs is enabled, links result in a white screen with warnings
ThreadText: # CiviMail - when Track Click Throughs is enabled, links result in a white screen with warnings
  
  (Asked by: username_0 on 2015-06-26)
  
  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](https://civicrm.stackexchange.com/questions/3279/civimail-tracked-urls-give-missing-input-parameters-from-extern-url-php)) 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](https://civicrm.stackexchange.com/questions/2421/why-do-track-click-through-links-not-redirect-to-correct-address)). The links look correct and the permissions of url.php are 644.
  
  Any help or direction on either of the warnings is greatly appreciated!
  
  **Tags:** civimail
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-06-28. Score: 4 | Accepted answer
  
  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
  
  > **Comments:**
  > **username_0**: Thank you Richard!  Fixing the timezone issue made the links work when tracking is enabled.  
  
  ---
  
  ### Answer by username_1 on 2015-06-28. Score: 5
  
  Richard's answer is correct. While this seems unrelated, look at [this answer](https://civicrm.stackexchange.com/questions/2555/error-when-printing-pdf-letter-or-mailing-label-from-search-results-list/2560#2560) 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](http://www.electrictoolbox.com/php-change-timezone/) anywhere in your civicrm.settings.php file.
  
  > **Comments:**
  > **username_0**: 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.  
  
  ---
  
  