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.

Was this answer helpful?

Related Articles

How to Make All .html Pages to Run as .php Files Using .htaccess

PHP can be extremely useful when used in conjunction with HTML to enhance the features of a...

How to change my PHP version

We are glad to inform you that you can change the current version of PHP even on shared hosting...

How to change the max memory and max upload limit

Changing of PHP variables is easy on our shared hosting plans. You have full control and you...

Why is phpinfo() Disabled and How to Enable It

The phpinfo() function shows information about server settings and the Kernel version. Such...

How to Set Custom PHP Version per Directory

The PHP version is important not only for speed and performance. There are different...

Powered by WHMCompleteSolution