How to Set Website’s Timezone Using php.ini

If you notice the correct time is not showing in your PHP scripts, likely root cause is that the hosting server is in a different timezone. You can easily take care of this by including a line of rule to your php.ini file. The location you set in the rule will determine the time to show in your PHP programs.

For doing that you can follow the steps below,

First of all you need to login to the server and go to the public_html folder. You can use File Manager in your control panel to do this.

Create a php.ini file in your public_html directory and add the following code to the file,

date.timezone=TIMEZONE

Make sure to replace “TIMEZONE” with the specific timezone you want to display.

Once you have entered the desired timezone, click the Save Changes button to save the file.Your website timezone will be changed as you have set.

Now, you can check your phpinfo.php page to verify the change took place.