How to change PHP timezone for your website

Updated on Apr 12, 2019

If you have noticed that the correct time is not displaying in your PHP scripts it is because the server is in a different timezone. You can easily resolve this by adding a  line of code to your php.ini file. The location you set in the code will determine the time to display in your PHP scripts.

Access your cPanel account -> File Manager

Open your local php.ini file with the Edit Code tool from the upper menu on the same page. If there is no php.ini. If there is no such file you should create one from the File Manager -> New File and you should name the file php.ini note that the file should be created in the root folder of your application

Add the following line of code to top of your php.ini file:

date.timezone = “US/Central”

Replace “US/Central” with the timezone you wish to use. You can review a list of available PHP timezones that correspond to the time you want to display.

Once you have entered the desired timezone, click the Save Changes button to save the file.

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!

SSD Cloud Hosting

  • Free Domain for life
  • 24/7 Technical Support
  • Fast SSD Storage
  • Hack-free Protection
  • Free Script Installation
  • Free Website Transfer
  • Free CloudFlare CDN
  • Immediate Activation
View More