What is PHP default timezone?

If you notice the incorrect time in your PHP scripts, the likely culprit is that the hosting server is in a different timezone.

For example, when you’re an InMotion web hosting customer, you can select from data centers in Washington, D.C., or California, which means the server’s timezone will be either Eastern Standard Time (EST) or Pacific Standard Time (PST).

If you want to change that, it’s a quick fix. Simply insert a line of code into your php.ini file and the location you set in the code will determine the time to display in your PHP scripts. Keep reading to learn how.

Set the Timezone in PHP

  1. Open your php.ini file with the File Manager in cPanel .
  2. Add the following line of code to top of your php.ini file: date.timezone = "US/Central".

    What is PHP default timezone?
  3. Replace US/Central with the timezone from here that corresponds to the time you want to display.
  4. Once you have entered the desired timezone, click Save Changes to save the file.

    What is PHP default timezone?
  5. Now, you can check your phpinfo.php page to verify the change took place.

What is PHP default timezone?
What is PHP default timezone?

Drag the arrow to the right to see the change in the timezone setting

Congratulations! You are now able to set the timezone in PHP. If you wish to see more guides with tips and information for your website issues, please see our InMotion Hosting Support Center!

Sell hosting using your own brand with a powerful Reseller Hosting plan, now with more resources and faster storage using SSDs at no extra cost.

Simply Schedule Appointments relies on WordPress to successfully configure the PHP default timezone function to UTC. This is a function that the majority of plugins should not be modifying themselves, but we sometimes come across some that do. When this happens, SSA (and probably other plugins, too) can break and appear buggy.

One of the biggest symptoms SSA shows with this error is that all of your dates and times will shift regardless of whether you’re using the correct timezone in the plugin.


Confirming a PHP Default Timezone Error

There are two ways to confirm whether you’re dealing with this issue.

Check SSA Support Tab

Go to the SSA Support tab and if you look under PHP default timezone, there should be a message saying:

“PHP default timezone was changed after WordPress loading by a date_default_timezone_set() function call. This interferes with correct calculations of dates and times.”

What is PHP default timezone?
Error is shown in the SSA support tab

Check the Site Health Panel from your WordPress Dashboard

From your WordPress Dashboard, go to Tools > Site Health. Under Critical Issues, you should see the following error, “PHP default timezone is invalid”.

What is PHP default timezone?
Site health panel showing error under critical issues

How to Fix PHP Default Timezone Error

We’ll need to track down the plugin or theme causing this error. To do so, we recommend that you complete the following steps on a staging site if possible or make sure to create a backup on your live site before you continue.

  1. See if it’s a plugin conflict by disabling all other plugins, or by using Plugin Detective to quickly identify a conflict
  2. See if it’s a theme conflict by switching to a default WordPress theme.

We offer a guide to walk you through the troubleshooting process using Plugin Detective.

Once you’re able to narrow down on the culprit that’s modifying the date_default_timezone_set() function, you have two options. Either disable the plugin/theme (if it’s unnecessary or if there’s an alternative one you could use) or you can try contacting the developer and mentioning that WordPress requires the timezone to be UTC in order to function properly.

You could also send them the following article that offers helpful suggestions in fixing this issue in the code itself.


Still stuck?

with our five-star support team to get more help.

File a ticket

  • Name:*

    First Last

  • Email:*

  • The issue you need help with:

    Please provide any information that will be helpful in helping you get your issue fixed. What have you tried already? What results did you expect? What did you get instead?

  • Name

    This field is for validation purposes and should be left unchanged.

Δ


  • What is PHP default timezone?

    Appointment Type Labels

  • What is PHP default timezone?

    Asset CleanUp Pro Conflict – Redirecting to Homepage

  • What is PHP default timezone?

    All In One WP Security – “You are not authorized to perform this action”

  • What is PHP default timezone?

    Email Delivery Issues


  • How was this guide?

    • Great
    • Meh
    • Not great

  • Excellent! Glad this guide was helpful to you. Thank you for taking the time to let us know that it helped you out.

  • Just meh?

    Sorry this guide wasn't great. Would you mind taking a minute to let us know how we could make it better? We read every comment and are always looking for ways to improve our help center.

  • If this guide didn't help you solve your issue, please get in touch with our support team for more help.

  • Not great?

    We're sorry that this guide wasn't helpful to you. Would you mind taking a minute to let us know how we can make it better? We read every comment and are always looking for ways to improve our help center.

    What is the default time zone in PHP?

    Reading the timezone set using the date_default_timezone_set() function (if any) Reading the value of the date. timezone ini option (if set) If none of the above succeed, the default timezone will be UTC.

    Where is PHP timezone set?

    Open Hosting → Manage → PHP Configuration page. There, open the PHP options tab and edit the date. timezone value: If you are not sure which time zone to insert, check the Time Zone Map.

    How to set UTC time in PHP?

    date_default_timezone_set() sets the default timezone used by all date/time functions. Instead of using this function to set the default timezone in your script, you can also use the INI setting date. timezone to set the default timezone.

    How to set est time zone in PHP?

    php echo date_default_timezone_get(); $currenttime = date('h:i:s:u'); list($hrs,$mins,$secs,$msecs) = split(':',$currenttime); echo " => $hrs:$mins:$secs\n"; date_default_timezone_set('US/Eastern'); echo date_default_timezone_get(); $currenttime = date('h:i:s:u'); list($hrs,$mins,$secs,$msecs) = split(':',$currenttime ...