I keep changing the timezone setting to Europe/London
at first if I display the time on a test page with <?php echo date('Y-m-d H:i:s'); ?> it will show the correct time but after a few minutes it’ll display the american time and checking in Cpanel shows that the time zone has reverted back to the default as shown here
As far as I know, the time zone is only changed if you click the “Alter PHP Directives” button in the control panel (or manually set it in PHP or .htaccess, of course). If the New York timezone is selected there when you hit that button, the time zone will be set to New York.
It’s possible that the control panel doesn’t correctly read the current setting from your configuration file. So if you go to the control panel page, it always shows the New York time zone, regardless of what’s actually on your site. And if you then click the button, that time zone is set.
while monitoring the time on my website test page as soon as i see the time change from london to america time (usually a few mins) I go back to cPanel https://cpanel.epizy.com/panel/indexpl.php?option=phpchangeconfig_configure and click on alter php directive and thats when I see that the timezone has changed back to america
but since ive added the code to the .htaccess file I see that the timezone stays on london in the webpage and in the cpanel
I’m sorry, just to make sure I’m understanding your message correctly:
You’re saying that you are setting the time zone to London, and then out of the blue it reverts to New York time? You don’t access the Alter PHP Directives menu in between at all?
The Alter PHP Directives works by editing the .htaccess with the exact code that @TigerMANEK426 provided too.
Did you overwrite the .htaccess file with a local copy or something like that? That would explain why the setting “alters itself”. It’s not altering itself, you’re altering it by overwriting the configuration.
its possible that there was an htaccess file when i first signed up for an account and it may have gotten deleted, honestly I couldnt say, the only file I remember deleting was index.html
I did create a htaccess file recently for custom error pages
would you possibly have a copy of an original .htaccess file for a new account in case there is something vital missing from mine so I can join it to my own, thanks
— edit ----
I just looked and there is a .htaccess file in the root directory just before the htdocs direcrory but theres nothing in there about timezones .htaccess (698 Bytes)
When you use the Alter PHP Directives tool, it applies the configuration like time zones by writing it to the .htaccess file in the htdocs folder of your website.
The .htaccess in the root directory doesn’t have anything to do with this.
interesting, I just changed the timezone in cPanel from Europe/London to america/denva and downloaded my .htaccess file and I see three lines were written into it ( this wasnt happening originally and nothing was written into .htaccess )
php_value display_errors Off
php_value mbstring.http_input auto
php_value date.timezone America/Denver
experiment #2
removed the lines and uploaded .htaccess then checked the time is back to the default again
back to cpanel changed timezone to Europe/London and downloaded the .htaccess file and the 3 lines are back and time is correct
so for some weird reason the three lines wasnt getting written originally but now they are