1
votes

I am getting following error whien i use php -i

date

date/time support => enabled "Olson" Timezone Database Version => 0.system Timezone Database => internal PHP Warning: Unknown: 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_timezon
e_set() function. In case you used any of those methods and you are still gettin
g this warning, you most likely misspelled the timezone identifier. We selected
'UTC' for 'UTC/0.0/no DST' instead in Unknown on line 0 Default timezone => UTC

Directive => Local Value => Master Value date.default_latitude => 31.7667 => 31.7667 date.default_longitude => 35.2333 => 35.2333 date.sunrise_zenith => 90.583333 => 90.583333 date.sunset_zenith => 90.583333 => 90.583333 date.timezone => America/Los_Angeles => America/Los_Angeles

My /etc/php.ini has following setting

[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = America/Los_Angeles

; http://www.php.net/manual/en/datetime.configuration.php#ini.date.default-latitude
;date.default_latitude = 31.7667

; http://www.php.net/manual/en/datetime.configuration.php#ini.date.default-longitude
;date.default_longitude = 35.2333

; http://www.php.net/manual/en/datetime.configuration.php#ini.date.sunrise-zenith
;date.sunrise_zenith = 90.583333

; http://www.php.net/manual/en/datetime.configuration.php#ini.date.sunset-zenith
;date.sunset_zenith = 90.583333

PHP version details are as below

PHP 5.3.3 (cli) (built: Dec 5 2013 07:09:40) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Apache version as below

Server version: Apache/2.2.15 (Unix) Server built: Jul 18 2014 02:31:29

I have restarted Apache multiple times

2
can you do phpinfo() and show the path of php.ini file?Dileep Kumar
When you run php -i from a command prompt Apache is not involved at all.Álvaro González
it is /etc/php.iniVineet Desai
@ÁlvaroGonzález - agreed, but error is same in either caseVineet Desai
try this date.timezone = "America/Los_Angeles", add double quote around.Dileep Kumar

2 Answers

0
votes

change date.timezone = UTC then run command sudo service httpd restart

0
votes

You could use inside of PHP file:

date_default_timezone_set( "YOUR DATE TIME ZONE");

for example:

date_default_timezone_set( "Europe/Berlin");

List of timezones: http://php.net/manual/en/timezones.php

or if you wish to continue using server timezone but want to hide warnings use:

ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(E_ERROR);