Skip to content

PHP Warning: date() and strftime()

Share

Here is the latest set of PHP errors I received from a live web support chat client after a PHP upgrade from 5.1 to 5.3.

PHP 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.

PHP Warning: 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. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

This crippled the system for me, luckily the fix was easy. Try this out yourself if you’ve started to receive the same error from any of your php scripts.

If you don’t have access to edit your php.ini file directly, you will need to contact you web host support to apply the fix.
Step 1: Open up the php.ini file
Step 2: Look for a commented line that says something like

;date.timezone =

Step 3: Uncomment that line and enter your timezone after the =.
You can find a list of timezones supported by PHP here: http://www.php.net/manual/en/timezones.php

Now check your error logs and see if your scripts are still throwing the same error, it fixed the issue for me though.

Share Our Posts

Share this post through social bookmarks.

  • Delicious
  • Digg
  • Newsvine
  • RSS
  • StumbleUpon
  • Technorati

Related posts:

  1. Vbulletin Upgrade: Illegal mix of collations
  2. PHP Code Being Output Instead Of Rendered

Comments

Tell us what do you think.

There are no comments on this entry.

Trackbacks

Websites mentioned my entry.

There are no trackbacks on this entry

Add a Comment

Fill in the form and submit.

Twitter Status

Archives