Feb 26, 2021 cPanel

How to set the PHP time zone in the .htaccess file – cPanel and Plesk

In this article we will describe how to set PHP timezone setting in .htaccess using cPanel or Plesk control also you can do it via SSH.

Using the date.timezone directive

By default, UnivaHost servers are set to use the ASIA and USA Time zone. You can change the time zone that PHP uses for your scripts by setting the date.timezone directive in an .htaccess file.

For a complete list of supported time zones in PHP, please visit

http://www.php.net/manual/en/timezones.php

How to set the time zone, follow these steps:

1. Login your account using cPanel, Plesk, or SSH

2. Use a text/code editor or if you use any Hosting control panel you can use cPanel or Plesk default editor to add the following line to the .htaccess file. Replace Region/Zone with your own time zone:

php_value date.timezone ‘Region/Zone’

3. Save the changes to the .htaccess file and exit your code/text editor.

4. To verify that the new setting is active, create a PHP test file that contains the following code in the same directory where the .htaccess file is located:

<?php phpinfo(); ?>

5. Load the test file on your web browser, and then search for the name of the directive. The Local Value column should display the new setting that you specified in the .htaccess file.

Check More Article

SHARE NOW

Leave a Reply

Your email address will not be published. Required fields are marked *