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:
PHP configuration changes can be made from cPanel by following these steps:
date.timezone, and select the value that you require.
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.
The second method to change your date.timezone is in the
.htaccess file, which can be accessed via File Manager in cPanel.
.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 "America/Cayenne"
To set the default timezone in a PHP file use the code:
<? php date_default_timezone_set('America/Denver'); // ?>
You can also set in PHP the environmental variable TZ
<?php putenv("TZ=Africa/Accra"); ?>
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!