SetEnv TZ Trouble

software development

#1

I’ve searched the forums and read all posts concerning timezones. The best solution I found for changing my websites timezone was to add “SetEnv TZ Europe/London” to my .htaccess file (I also tried "SetEnv TZ GMT).

I did this and php echo date(“d/m/Y G:i T”); still gives me PST.

Can anyone help me solve this problem?

Any tips will be hugely appreciated,
Rich.


#2

From within your php script you can use the following to set the TZ environment variable:

putenv(‘TZ=Europe/London’);

Once Dreamhost have upgraded to PHP 5.1 (or if you have compiled your own copy), you can use:

date_default_timezone_set(‘Europe/London’);


#3

Thanks for the reply.

So SetEnv doesn’t work here then?

I was trying to avoid adding putenv to all my scripts, it’s looking like I don’t have a choice, meh.