Dealing with PHP 5.3 Timezone Errors

From Acenet Knowledgebase
Revision as of 15:56, 13 January 2013 by Docs admin (Talk | contribs) (Created page with "PHP 5.3 requires that you set the timezone setting within PHP, and not use the system timezone settings. The error may look similar to the following: <syntaxhighlight lang="...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PHP 5.3 requires that you set the timezone setting within PHP, and not use the system timezone settings. The error may look similar to the following:

Warning: strftime() [function.strftime]: 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.

There are two ways to handle this. Either edit your local local php.ini file, or edit your index.php file.

More details on custom php.ini files can be found here:

How can I change PHP settings?


Edit your local php.ini file

Locate your local php.ini file, and add the following line to it:

date.timezone = "America/Detroit"

Edit your index.php file

Add the following line to your index.php file, just under the php tag near the top of the file:

date_default_timezone_set('America/Detroit');

Locating your local TimeZone name

You can find the official name of your timezone by visiting the PHP website:

Timezones at php.net