How to Setting default time zone in apache webserver for php
Sometimes when you using php script, it doesn’t show the correct time. We can easily resolved this problem by setting some string in php.ini script. In Linux, if you installing apache2 and php5 manually, browse to directory /etc/php5/apache2/. you can find php.ini on it. just do some command :
nano /etc/php5/apache2/php.ini
Find string :
;date.timezone =
Edit it to your timezone ( Example in my PC )
date.timezone = “Asia/Makassar”
For your city, just browse to timezone










3 Responses to “How to Setting default time zone in apache webserver for php”
age
on May 12, 2009
I tried, no luck. after i change the timezone in pnp.ini to “Asia/Jakarta” and have a page contains echo(date_default_timezone_get());
it still shows: Asia/Krasnoyarsk
.. any clue.. BTW its 1 hour differece with my LOCAL time
thxComment posted using
Mozilla Firefox 3.0.10 on
Windows XP
Reply
dedyisn
(77 comments.) on May 13, 2009
what OS that u use ? windows ? I’m not sure where php.ini is stored in windows cause it depends on your server that u use . sometimes php.ini store in C://Windows/ or in Apache folder. But make sure if you have change, restart your apache webserver .
Mozilla Firefox 3.5b4 on
Windows XP
For example in my PC, i’m using appserv ( it’s included apache2,php5,mysql and phpmyadmin) . I just edit php.ini in C:/appserv/apache/php.iniComment posted using
Reply
Endrik
on Aug 13, 2009
Try to put below code before you execute some date function:
putenv(”TZ=Asia/Jakarta”);Comment posted using
Mozilla Firefox 3.0.12 on
Windows XP
Reply