How to Rectify ‘Warning: date() []: It is not safe to rely on…’ Error Notice

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 ‘America/Los_Angeles’ for ‘PDT/-7.0/DST’ instead in /home/yourwebhostingaccountpublic_html/…/index.php on line 2

I got this annoying notice on all of my non-wordpress websites for quite a time, I think since September 5th of this year.

First off, I received a message, sometime in August, from my webhost, lunarpages (great webhost, by the way), about their implementation of an upgrade from PHP 5.2 to 5.3.16 since the former was supposedly already deprecated and is no longer supported.

Lazy as I am and being an A-1 member of my own one-man Procrastinators Club, I let it be and eventually forgot about it.

Thus, around the second week of September, these ‘Warning: date() []‘ error notices began appearing in my non-wordpress site’s header and footer areas. Wherever there is a date displayed, the notice is always displayed above it. And this addition is such an ugly eyesore.

But believing that I’m yet too busy (with office work, tutoring my kids, and some important stuff like watching ‘just for laughs’ on youtube for hours, etc.) to get working on it, I just let it be for awhile.

I finally had enough of it, though, just today (that’s almost a month afterwards!) and set off to work to find the cause and learn how to rectify the problem. Well, not including the time spent on researching for the solution, it actually only took a couple of minutes, more or less, to get things back to normal.


Warning: This worked on my sites. This will probably work for you, too. Otherwise, you’ll probably need additional research along this line.

Here goes:

  1. Download the php.ini file from your webhost server.
  2. This is probably located in your public_html folder. That’s where I found mine.

    My googling returned other suggested paths like:

    • /etc/php.ini
    • /usr/bin/php/php.ini
    • /wwwroot/php/php.ini
  3. Add the following lines in the php.ini file:
  4. [Date]
    date.timezone = “America/New_York”

    Of course, you need to check if the date.timezone is already there. If so, you just need to change its value to “America/New_York” or to any value applicable for you. Go here for a list of supported timezones.

  5. Re-upload the edited php.ini back to where you downloaded it in your webhost server. Overwrite if you must. Of course, to be on the safe side, you have to have a backup copy of the original,just in case.
  6. Check your affected websites again. One poster in a forum says you then need to re-start Apache. Hell, I don’t know how to do that (yet). But mine worked without having to do that.
  7. That’s it.

In case you have no inkling about these things, you may have to either hire someone or contact your webhost and request for assistance.


    1. I don’t know why your comment landed on the spam folder Sire. But lucky for me, I took a peep at the folder and fished this one out. 🙂

      As to the warning, I suppose I didn’t turn off error reporting, and I’m keeping it that way. I think I like to be notified of any error and learn how to fix it accordingly.

  1. Most hosting providers won’t let you mangle with their php.ini directly. The easy solution to this is to add error suppression at the beginning of your code:


    That will do it 🙂

Comments are closed.