Tuesday, November 2, 2010

Changing Timezone in php configuration file

How can I change the time zone? A simple solution is to modify the value in the php.ini file.
Open the php.ini file. If you don’t know, where the php.ini file is placed, try using phpinfo file.
<?php
phpinfo();
?>
create a file with the above lines and execute this file in the browser.
Wow..
You get all the info regarding the server , components installed and other info. Always remember, it is vulnerable to display the server info to the end user. You can better delete the file, once you are done.
I gave the below screenshot, to guide you to find the php configuration file (php.ini)

Once you found the file, open in an editor and search for the string “timezone”. There you find the default time zone.
[Date]
; Defines the default timezone used by the date functions
date.timezone =
You can change the time zone, as you wish. You can get the list of timezones in this link
http://in2.php.net/timezones
For example, if you need to change it to costa rica time zone, simply modify the above line as
Date.timezone = ‘America/Costa_Rica’

No comments:

Post a Comment