Search results for:
Table of Contents
This guide is intended to guide how to set up or change the PHP timezone for Linux-based services here at Hostwinds, setting and/or editing through cPanel, WHM, or commands within Linux.
Step 1: Log into your cPanel account (How to log into cPanel)
Step 2: Select File Manager
Step 3: Select Settings and make sure Show Hidden Files is checked, then click Save.
Step 4: Navigate to the folder public_html, and you should see a file called .htaccess within this directory. If you cannot see files that start with a dot and this is hidden, please make sure you have enabled showing hidden or dotfiles in File Manager.
Step 5: Right-hand click on the .htaccess file and select edit. If this file does not exist, you will want to create a new file named .htaccess.
Step 6: Search if there is already a timezone within the file; it should look like:
php_value date.timezone ‘Region/Timezone or SetEnv TZ ‘Region/Timezone’
Step 7: If there is or is not, edit or add the following line within .htaccess with the time-zone you wish:
php_value date.timezone ‘Region/Timezone’
(Please review here for available time-zones for PHP)
Step 8: When complete, your .htaccess should have the code look similar to the below image. Save Changes ( top right) to the file when done.
As our shared and business services are shared, editing .htaccess will provide a quick resolution when needing to update your website's timezone if this needs to be different than America/Los_Angeles.
Step 1: Log into your WHM ("How to get started with your new WHM/cPanel server")
Step 2: Under Server Configuration, select Server Time
Step 3: Select the drop-down icon and select the time zone you wish. Click the Change Time-Zone button when done.
Step 4: If your server's current time for whatever reason is not synced, select the Sync Time with Time Server button. This will ensure your new time is synced with your server moving forward.
Step 5: Within WHM's search bar, search for reboot and select Graceful Server Reboot from the available options that appear. Click "Proceed > () when ready.
If you would like to edit the individual cPanel(s) PHP timezone, please see the above steps under How to edit Hostwinds Shared and/or Business Hosting Services. The same steps will change the PHP timezone for that specific cPanel account.
Directions should apply for any of the following operating systems: CentOS, Ubuntu, Fedora, Windows, and Debian
If using SSH from a Windows computer, please make sure you have an SSH tool installed like PuTTY
Step 1: See what the current time-zone is by typing the date command or ls command
ls -l /etc/localtime
Step 2: Type the following commands to change the current time within SSH
Administrator or root access is required. The syntax is as follows to set timezone:
timedatectl set-timezone time_zone
In this example, set timezone to America/Denver
timedatectl set-timezone America/Denver
Your time zone will now be changed on your server
It is possible to check your current timezone if you do not have access to WHM > Server Time. The following steps will demonstrate how to get access to your current domain's PHP time zone.
Step 1: Navigate to your cPanel and the Document Root folder (public_html for most cases)
Step 2: Create a file within your root directory called phpinfo.php
Step 3: Once the file is created, select it and right-click to edit
Step 4: Within the blank PHP file, insert the following code:
** Save Changes ( top right) to the file when done **
Step 5: Now that the phpinfo.php has been created, navigate to your domain.com/phpinfo.php. A page similar to this should display.
Step 6: Find the category Date, Default Timezone, and date. Timezone (under local) should show your new time.
If we can help you in any way, please submit a ticket, or join us in a Live Chat anytime. We are available 24/7/365, and we are dedicated to our client's success; every client truly matters to us.
Written by Hostwinds Team / April 6, 2018