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



Senior Tech Writer for Vodien Internet Solutions

Bill Poh is the Senior Tech Writer at Vodien and he covers web hosting, online marketing, social media, business and the latest tech innovations. When not writing, he’s busy pursuing his passion for photography, graphic design, and creative arts.

Here are some of the other pages created by Bill Poh: