How to Rectify ‘Warning: date() [function.date]: It is not safe to rely on…’ Error Notice
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 ‘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() [function.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.
- Download the php.ini file from your webhost server.
This is probably located in your public_html folder. That’s where I found mine.
My googling returned other suggested paths like:
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.
In case you have no inkling about these things, you may have to either hire someone or contact your webhost and request for assistance.
Filed under: Website
Like this post? Subscribe to my RSS feed and get loads more!