In this article, we will show you how to change the PHP date.timezone on your website using the .htaccess file. Let’s take a look!
Changing PHP date.timezone with .htacess File
Before we go any further, make sure you know which timezone you want to use for your site. You can refer to this manual for a list of available timezones.
How to Change PHP date.timezone Through hPanel
.htaccess is a file located in public_html directory that you can edit using the File Manager on your Hostinger account, or via an FTP Client like FileZilla.
Login to your hPanel and navigate to the File Manager under the Files.
Scroll down and locate the .htaccess file. If it’s not available, click on Create a new file option in the upper part of the page.
Right-click on the file and select Edit.
Enter the following code at the very top of your .htaccess code:
php_value date.timezone 'country/state'
Here we’re using “America/Chicago” as an example.
Click Save & Close when you’re done.
How to Change PHP date.timezone Using an FTP client
You can also edit the .htacess file with an FTP client, such as FileZilla:
Elvinas is a senior server administrator at Hostinger. He monitors the infrastructure’s well-being and keeps the uptime at a maximum. Besides server management, web development has always been one of his biggest passions.
Leave a reply