(mt):Modify the default PHP timezone
- This page was last modified on April 14, 2012, at 21:38.
From (mt) Community Wiki
Contents |
Overview
All (mt) Media Temple servers are located in one of two data centers, California, or Virginia, and the default PHP time zone for these servers depend on what data center they are in. However, some users may want their PHP applications to run in a different timezone. Making this modification is as simple as adding a single line to the php.ini file, and this wiki article will show you how.
This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.
Requirements
(dv) Dedicated-Virtual Server users should have root enabled, and be comfortable editing files via SSH.
It is assumed (ve) Server users are using a default installation of Apache, and the default php.ini location of /etc/php.ini.
Instructions
On the (gs) Grid-Service
- Open the File Manager inside the AccountCenter.
- Choose the folder called etc.
- Click the file called php.ini.sample, it may also be called php.ini if you have edited this file before.
- Once the file is open, add the following to any blank line underneath [PHP]:
/etc/php.iniPlease note that this would set the timezone to Bermuda (-4 UTC), modify the timezone to whatever you would like it to be. For a list of timezones that PHP supports, visit the following PHP website.
date.timezone="Atlantic/Bermuda"
- If the file is called php.ini.sample, change the file name to read php.ini (see Figure 1).
If it is called php.ini, proceed to the next step. - Press the "save changes" button.
- To verify the new timezone is working, set up and load a PHP Info page.
- You are done!
On the (ve) Server and (dv) Dedicated-Virtual Server
- Log into the server as root.
- Open up /etc/php.ini in your favorite text editor, and add the following to any blank line underneath [PHP]:
/etc/php.iniPlease note that this would set the timezone to Bermuda (-4 UTC), modify the timezone to whatever you would like it to be. For a list of timezones that PHP supports, visit the following PHP website.
date.timezone="Atlantic/Bermuda"
- Save the file, and restart Apache:
/etc/init.d/httpd restart
- To verify the new timezone is working, set up and load a PHP Info page.
- You are done!
Resources
PHP page about date and time configuration
List of supported PHP timezones