I am using the following on all my index.php files to include a global footer:
<?php include($_SERVER['DOCUMENT_ROOT'].'/_footer.php'); ?>
The _footer.php file itself doesn’t have much content apart from the PHP to return the current year:
<div class="footer">
<p id="left">Company Address</p>
<p id="right">Copyright <?php echo date("Y"); ?> Company Incorporated</p>
</div>
</div> <!-- end .wrapper -->
</body>
</html>
While the above code works when uploaded to the web server, it does not work in my localhost (Mac OS X with Coda 2) and I get the error message:
WARNING: DATE() [FUNCTION.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 ‘UTC’ FOR ‘GMT/0.0/NO DST’ INSTEAD IN
/USERS/USER/SITES/COMPANY/EXAMPLE.COM/_FOOTER.PHP ON LINE 3
I would posit that it wouldn’t be such a problem to set the timezone or not (since it’s a simple function designed to show the year only), but it breaks the design of the footer when local testing:

All the text (e.g. “COPYRIGHT”) is meant to be inside that yellow box.
What should I do in this case?
Have you read the error message? It quite clearly states that it is not safe to rely on the system’s timezone settings, and that you are required to use the
Date.Timezonesetting or thedate_default_timezone_set()function.So, do one or the other.
Either a) Modify your
php.inito have this:or b) Call this above your call to
date()(or in a globally included script):Obviously,
Europe/Londonshould be replaced with your actual timezone identifier of which a list is available here: http://php.net/manual/en/timezones.phpJust an additional note, if it’s not showing on your server it’s because either
display_errorsis disabled, or your error reporting level is lower than it is in your development machine, which it certainly should be.