Knowledgebase:
How can I change the timezone using PHP/.htaccess?
Posted by Brian F., Last modified by Brian F. on 06 August 2012 07:14 PM

In the event you need to localize your time via PHP for your applications/scripts/website, you can make the change easily via your .htaccess file. Please note the servers timezone cannot be changed however. For purposes of this article we'll be using cPanels File Manager, though these changes can be made via SSH or any FTP client (we suggest FileZilla). To change your timezone via .htaccess:

  1. Login to cPanel for your account, and in the top left finder search for File Manager. (Picture)

  2. Select the File Manager icon, and you'll be greeted with a popup. On this dialogue, you'll want to select 'Web Root' for the directory also select 'Show Hidden Files (dotfiles)'. (Picture)

  3. Once your File Manager opens, locate your .htaccess file and click it. Once highlighted, select 'Edit' from the top navigation. You will be prompted with another dialogue box, just hit 'Edit' to continue to the editor. (Picture)

  4. Now that you're editing your .htaccess, add the following lines to your file: (Picture)

    php_value date.timezone "America/Chicago"

    Replace "America/Chicago" with the timezone you wish to use. This will now change the timezone for your applications/sites to the one specified.

  5. If you need a list of all supported timezones, please reference the following URL: Supported PHP Timezones
(6 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).