PDA

View Full Version : Set timezone without modifying code


guvenck
02-09-2007, 12:54 PM
Hello,

I moved to a new server with a completely different timezone.

I had written php/mysql applications for nearly all the domains I am administrating. I record user registration, activation and login times via


$now = date('Y-m-d H:i:s');


in LOTS of pages and insert the $now into a DATETIME field in DB.

Naturally, everything messed up after moving the server. It is not a dedicated one and changing the server time is not allowed, so I need to find a way to adjust the timezone without changing the code.

Options that I think of are .htaccess, custom php.ini and ini_set variables.


I run PHP 4.4.4, Apache 1.3.37 and MySQL 4.1.21 std.

Any advices?

guvenck
02-09-2007, 01:18 PM
I placed a .htaccess into my document root and typed

SetEnv TZ Europe/Istanbul

to it, now it looks I have a correct timezone.