Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  How-Tos  >  How to set the Timezone for PHP in the php.ini file
Top Scroll

How to set the Timezone for PHP in the php.ini file

 2 min

If the correct time is not displaying in your PHP scripts, you will need to make some changes on your hosting server. This can be easily done by adding a line of code to your php.ini file.

So let’s see how to set the Timezone for PHP:

Step 1: Open your php.ini file with the File Manager in cPanel

Step 2: Add the below-mentioned line of code to top of your php.ini file

date.timezone = "US/Central"

Step 3: Replace “US/Central” with the timezone from here that corresponds to the time you want to display.

Step 4: Once you have entered the timezone you want to set, click the Save Changes button to save the file.

Step 5: Now, you can check your phpinfo.php page to verify the change took place.

Before:

After:

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.