Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Configuration: It is not safe to rely on the system's timezone settings [duplicate]

Tags:

timezone

php

Here a weird one. I just upgrade to php 5.3.0 and since the upgrade I'm getting the following warning:

Warning: getdate() [function.getdate]: 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/Chicago' for 'CST/-6.0/no DST'

After looking in various forums, everybody says that to solve the problem, all you have to do is edit the date zone in the php.ini and restart Apache.

It did not work for me.

I tried

date.timezone="America/New_York"  date.timezone=America/New_York  date.timezone="US/Central" 

Restarted apache after I made the change.

Since I still have the older version of php install, I even made sure that I'm editing the php.ini that the current version of php uses at the time to load

/usr/local/php5/lib/php.ini

Still getting the warning.

Any suggestions?

Thanks for taking the time.

like image 586
Ole Media Avatar asked Feb 06 '10 15:02

Ole Media


1 Answers

Tchalvak, who commented on the original question, hit the nail on the head for me. I've been editing (I use Debian):

/etc/php5/apache2/php.ini 

...which had the correct timezone for me and was the only .ini file being loaded with date.timezone within it, but I was receiving the above error when I ran a script through Bash. I had no idea that I should have been editing:

/etc/php5/cli/php.ini 

as well. (Well, for me it was 'as well', for you it might be different of course, but I'm going to keep my Apache and CLI versions of php.ini synchronised now).

like image 94
Vaughany Avatar answered Sep 20 '22 17:09

Vaughany