How to change PHP timezone for your website

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.

  • PHP
  • 0 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

Powered by WHMCompleteSolution