Knowledgebase

How to Change the PHP Time Zone Using php.ini?

Imagine you are running a global website that caters to users from New York to Tokyo. A user schedules a meeting, and you want it to be perfectly timed for everyone involved. Or perhaps you are logging events and need timestamps to be accurate to troubleshoot issues effectively. Time zones might seem ordinary, but they are pivotal in how your application interacts with users worldwide.

Welcome to the exciting world of time zone management in PHP! Configuring the correct time zone ensures your application runs smoothly, keeps logs accurately, and displays the correct time regardless of where your users are. 

In this article, we will walk you through the simple yet crucial steps to change the PHP time zone using the php.ini file, transforming your server into a well-synchronized time machine. 

Let’s dive in!


Also Read: How to Increase the PHP Memory Limit in cPanel?


Steps to Change PHP Time Zone Using php.ini

➔ Login to cPanel.

Login to cPanel

➔ Once logged in, scroll down to the ‘Software’ section.

scroll down to the ‘Software’ section

➔ In that section, Click on ‘MultiPHP INI Editor.’

Click on ‘MultiPHP INI Editor

➔ You will see two tabs in the MultiPHP INI Editor: Basic Mode and Editor Mode.

MultiPHP INI Editor

➔ From those two tabs, You have to choose ‘Editor Mode.’

choose Editor Mode

➔ From the ‘Select a location’ dropdown menu, select the domain you wish to configure.

From the ‘Select a location’ dropdown menu

➔ Click on the input box next to ‘date.timezone’ and enter your desired time zone. The time zone should be in a valid time zone identifier format, such as ‘America/New_York, Europe/London, Asia/Tokyo’, etc.

valid time zone identifier format

➔ Once done, click the ‘Save’ button to apply the changes.

click on save


Also Read: How to Change PHP Version in cPanel?


That’s it; your PHP timezone has been changed!