February 21, 2011

Cloud Computing, Enterprise Cloud Technology < 1 min read

How To Use .htaccess To Set Server Environment Timezone For PHP Files

server timezone All servers have an inbuilt timezone, and this may have to be changed, especially if you're running a locale-specific or timezone-specific application. One way you could change your settings is to configure each PHP file to use a certain timezone, but if you're sure you want all PHP files in your server to use the same timezone, you can actually just configure the timezone using your .htaccess file.

To do this, open or create a .htaccess file in your root folder, and add the following line:

SetEnv TZ <location>

You need to replace <location> with the specific timezone you want to define. A list of timezones can be found at


[template id="7325"]

Skip to section