Black Friday Deals Not Found Anywhere Else! Save up to 55% OFF Hosting, Domains, Pro Services, and more.
Vodien Black Friday Sale applies to new purchase on select products and plans until 4 December 2024. Cannot be used in conjunction with other discounts, offers, or promotions.
Microsoft-Top-SMB-Cloud-Master-for-March-2017-img

by

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 http://www.php.net/manual/en/timezones.php.

 


[template id="7325"]

Skip to section