How to Change the PHP Timezone for Your Website

Updated on Oct 24, 2022

In some circumstances, you might need to modify your PHP setup in a specific way. One of these adjustments entails modifying the timezone of your PHP script. When the time is shown inaccurately in scripts and programs, making that modification is helpful. Three techniques for modifying the timezone of your PHP script are discussed in this post.

This post includes:

How to Change PHP Timezone for Your Website via the PHP Selector in cPanel

PHP configuration changes can be made from cPanel by following these steps:

  • Log in to cPanel.
  • Look for the Software section and click on Select PHP version;
  • The PHP Selector is not always included by default in cPanel. So, if you are not a FastComet client, it might be missing from your account. If that’s the case, you should contact your hosting provider.

Find the PHP Version Selector in cPanel

  • In the new window click on the Options button. Here you can locate the date.timezone, and select the value that you require.

Configure PHP Timezone

Here’s a list of the Supported PHP Timezones. Note that the region from which you can choose the sub-locations (in this case America), by default corresponds to the region set in the configuration file of the PHP Selector. That is an inherited value from the region of the server your account is on - at least for FastComet customers.

If you wish to use a completely different region, you can go past the PHP Selector config by using any of other two methods. Lastly, if you encounter a difficulty with any of those actions, feel free to contact our technical team anytime via a ticket.

How to Change PHP Timezone for Your Website in the .htaccess File

The second method to change your date.timezone is in the .htaccess file, which can be accessed via File Manager in cPanel.

In the .htaccess file use SetEnv TZ <timezone> to set the enviromental value TZ


SetEnv TZ Asia/Manila SetEnv TZ America/Fort_Nelson

You can also set here the date.timezone PHP value with php_value date.timezone “<timezone>”

php_value date.timezone "America/Cayenne"

To set the default timezone in a PHP file use the code:

<? php 


You can also set in PHP the environmental variable TZ


If you are experiencing any difficulties, you should submit a ticket via your Client Area, and our technical support team will gladly assist you further.

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

SSD Cloud Hosting

  • Free Domain Transfer
  • 24/7 Technical Support
  • Fast SSD Storage
  • Hack-free Protection
  • Free Script Installation
  • Free Website Transfer
  • Free Cloudflare CDN
  • Immediate Activation
View More