How to change timezone on Apache Webserver

My Apache Webserver had not timezone correct. It is very important to have same time zone settings between platforms when migrating existing calendar applications based on timestamp and using mktime() calls in php scripts.
I can remenber problems when changing platforms from wampserver to ubuntu apache web server with webcalendar, mrbs open source ….
How to check which timezone in Linux ?

date +%Z

If I wanted timezone correct, I had to do some configuration on Apache Webserver. But how to do this?
To change timezone on my Apache Webserver, I followed the next steps:

 sudo nano /etc/php5/apache2/php.ini

Search for “date.timezone” under [Date] and modify :


or to another timezone


Save the file and exit using CTRL+X;

Restart apache2 to take effect

 sudo /etc/init.d/apache2 restart

You can use phpinfo(); to read date end time zone configuration too under date



Since 20 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions. I am an experienced web-developer with over 10 years developing PHP/MySQL, C#, VB.Net applications ranging from simple web sites to extensive web-based business applications. When not writing code, I like to dance salsa and swing and have fun with my little family.

You may also like...