Thursday, 14 September 2017

How To Modify/Update Apache2 Time Zone(GMT)

  Modify/Update Apache2 Time Zone(GMT)




If websites are hosted on shared servers and the timezone is different, one may demand to change the timezone for their website.

We can change the timezone for the particular website using following methods.


The Apache2 time zone can be updated in two ways:
 
1) Using PHP configuration file php.ini also can be said as PHP initializing file.

2) Using .htaccess file

Let us see each of them in detail:

Updating time zone using php.ini initializing file

1) Check the global php,ini file location on the server
php -i | grep php.ini                                  
 
2) Open php.ini to modify
vim php.ini                                            
 
3) Search for "date.timezone"

4) Update the time zone
date.timezone="Asia/Kolkata"

5) Save the file

6) Restart Apache2 service

Updating time zone using .htaccess

1) Open .htaccess file present under the document root. If not present already, then create a new file.

2) Add line
SetEnv TZ timezone                                    
 
where timezone is the timezone you wish to set.

3) Edit & Save the file

No comments:

Post a Comment

Best forums to know about latest technology

Best websites/blogs/forums to know about latest technology For technology Digital Trends Web Trends Technology Technology T...