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 located in a different TimeZone.
Let us find out how to set the TimeZone in PHP:
- Log in to cPanel.
- Select the “File Manager” option under “Files” section.
- Locate “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 more latest updates, do visit our KB section regularly.