Ubuntu: How to update PHP’s timezone

 

We came across this one recently when setting up a Zabbix server, where the installation would not proceed until the PHP timezone was set. This is quite straightforward – using your favourite editor edit:

 

/etc/php5/apache2/php.ini

 

Look for the Module Settings section or search for:

 

 date.timezone

 

(in vi /date.timezone should get you there). Uncomment the line by removing the leading ; and then add in your desired timezone. For Sydney it would look like:

 

[Date]

; Defines the default timezone used by the date functions

; http://php.net/date.timezone

date.timezone = UTC+10

 

Change UTC+10 to your desired timezone, save the file and restart Apache:

 

sudo service apache2 restart

 

Voila!


Posted

in

,

by