WebFaction
Community site: login faq

I tried to add in the following date.timezone="Asia/Singapore"

into my php.ini file which located in /home/[$user_name]/webapps

However the timestamp of the php_error log still not showing the correct timezone. And the email that was send out in my wordpress is not according to the timezone that I have set. how do i overwrite the server timezone?

Thank you

asked 10 Oct '11, 11:28

kentzo
1144
accept rate: 0%


If you are wanting to view your logs from the command line in your local timezone, you can add

export TZ="Asia/Singapore"

to your .bashrc file.

permanent link

answered 10 Oct '11, 11:47

bmeyer71 ♦♦
1.5k3613
accept rate: 33%

I added the line to the .bashrc file and do the following to execute it:

. ~/.bashrc

However my log is still giving me the server timezone. [the time shoud be 11 Oct 07:57:33 in Singapore time]

[10-Oct-2011 23:57:33] case login:redirect c=http://www.momorice.com/wp-admin/
[10-Oct-2011 23:57:33] register case login:GotError, not logged in yet
[10-Oct-2011 23:57:33] will i hang here because redirect_page has been unset

Content of my .bashrc is as follows:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# User specific aliases and functions
export TZ="Asia/Singapore"
(10 Oct '11, 19:03) kentzo

I confirmed with another support person that your log timestamps will be in server time. This can't be changed on an individual basis. As for WordPress, you just have the timezone option under settings.

(10 Oct '11, 20:41) bmeyer71 ♦♦

I managed to change the timestamp in the php_error log. Actually the setting in the php.ini do set the timezone, however it is overwritten by a statement in wp-settings.php which is like this:

// Set default timezone in PHP 5.
if ( function_exists( 'date_default_timezone_set' ) )
   date_default_timezone_set( 'US/Central'); //this overwrite all settings!!

After changing the above to Singapore time, the php time function return me the correct Singapore Time.

However now i am facing another problem, ie. to set the correct time zone for mysql database. I tried to follow what this link recommend or try to execute the following after my database connection is established

mysql_query("SET SESSION time_zone = '+8:00'");

Both method does not set my database with correct time. How to set mysql database timezone?

(11 Oct '11, 10:03) kentzo

I just tested this, and I can confirm that you can set the timezone per connection by using the following query:

set time_zone = '+8:00';

Please make sure that you are trying to use date/time functions in MySQL in the same connection in which you've set the timezone.

(11 Oct '11, 10:43) todork
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×261
×242
×8

question asked: 10 Oct '11, 11:28

question was seen: 8,904 times

last updated: 31 Mar '12, 20:30

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM