This article explains how to set the TimeZone in PHP. Users need to set the TimeZone if they notice an incorrect time in their PHP scripts. This variation is mostly seen when a user is located in a different TimeZone.
Steps to set the TimeZone in PHP:
- Log in to cPanel.
- Select the File Manager option under the Files section.

- Locate the php.ini file, right-click, and click on the Edit button.

- Insert the subsequent code line at the beginning of your php.ini file: date.timezone = “UK/Central”.

- Substitute UK/Central with the TimeZone obtained from this source that corresponds to the desired time display.
- After entering the preferred TimeZone, save the file by clicking on Save Changes.

- You can now check your phpinfo.php page to confirm the change took place.
That is it! Hope you understood our article and that you can set the TimeZone in PHP. For the latest updates, do visit our KB section regularly.