Timezone Issue - Data is being logged in UTC instead of PST

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
yogeshbsharma30
Posts: 7
Joined: Tue Feb 24, 2015 4:15 pm

Timezone Issue - Data is being logged in UTC instead of PST

Post by yogeshbsharma30 »

I have come across many threads that tackle this issue. However, I cannot zero in on the problem using those. Someone please help me out.

System Timezone - PST
Database Timezone - SYSTEM (i.e. PST)
php.ini has date.timezone set as 'America/Los_Angeles'. However, php --ini shows Loaded Configuration File -> (none). Is that the root cause? If yes, how do I fix it?

In Console->System Utils->Tech Support, default timezone is America/Los-Angeles i.e PST. But the Cacti Log still shows readings being stamped with UTC in the RRDs.

If I run php -r "echo date_default_timezone_get();", I get the following output:

Warning: date_default_timezone_get(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC[yogesh@oea11 yogesh]$

Thanks a bunch!
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Timezone Issue - Data is being logged in UTC instead of

Post by BSOD2600 »

I'd guess there are multiple php.ini files and the one you've edited actually isnt in use. What does the phpinfo show for the 'Configuration File (php.ini) Path' ?
yogeshbsharma30
Posts: 7
Joined: Tue Feb 24, 2015 4:15 pm

Re: Timezone Issue - Data is being logged in UTC instead of

Post by yogeshbsharma30 »

Thanks for the prompt reply!

Here's a clipping of the phpinfo() results

Configuration File (php.ini) Path => /usr/local/apache2/conf
Loaded Configuration File => (none)
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Timezone Issue - Data is being logged in UTC instead of

Post by BSOD2600 »

Does php.ini reside in /usr/local/apache2/conf/ ?
yogeshbsharma30
Posts: 7
Joined: Tue Feb 24, 2015 4:15 pm

Re: Timezone Issue - Data is being logged in UTC instead of

Post by yogeshbsharma30 »

Yes, It is present there.

-r-------- 1 root root 423 Nov 13 2013 php.ini
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Timezone Issue - Data is being logged in UTC instead of

Post by cigamit »

What user is apache running as? Because I bet your problem is the permissions you have on that file.
yogeshbsharma30
Posts: 7
Joined: Tue Feb 24, 2015 4:15 pm

Re: Timezone Issue - Data is being logged in UTC instead of

Post by yogeshbsharma30 »

Apache is running as nobody. I used the ps -ef | grep httpd | grep -v `whoami` | grep -v root | head -n1 | awk '{print $1}' command to check that.
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Timezone Issue - Data is being logged in UTC instead of

Post by cigamit »

I would change the permissions on the php.ini file to 0644 and see if that helps.
yogeshbsharma30
Posts: 7
Joined: Tue Feb 24, 2015 4:15 pm

Re: Timezone Issue - Data is being logged in UTC instead of

Post by yogeshbsharma30 »

Hi,

I did that yesterday. Changed the permissions to 644 and even 777. Didnt seem to make a difference. I restarted the server but the config file wasnt getting loaded.

Noob Question: I was restarting the server using service apache restart. Is this the correct command?

Thanks again for all your inputs, guys!
Yogesh
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests