How To Change Your Domain PHP's Timezone in cPanel

cPanel PHP Settings: How To Change A Domain PHP Timezone

This tutorial shows you how to change or modify the PHP time zone setting of your PHP application/script using PHP Selector or cPanel’s MultiPHP INI Editor.

There may come a time that you want to change your PHP application time zone to match your current geographic location.

This may be for appointments, meetings and etc.

If you are a cPanel user, there are two options you can use to make this change on your control panel.

The one you elect to use will depend on the hosting package and PHP type that your account is running.

Server-wide timezone changes can only be made by a super-user (in this case, the Infrastructure team).

Given that our customers are from all over the world, we use UTC (Coordinated Universal Time) on most of our production machines.

You can check your current server timezone with:

$ date

The “date” command will display the system date and time with an output similar to this:

Mon Aug 15 02:11:13 UTC 2022

Setting Timezone For Super-Secure PHP Packages (altPHP)

If you are using one of our HardenedPHP packages, you will be using PHP Selector instead of cPanel’s MultiPHP INI Editor for cPanel.

The flow for making this change differs a bit.

To start, log in cPanel

Scroll down to Software and click on PHP Selector.

When the page loads, click on the Options tab.

Look at the available options and you will see “date.timezone”

Visit https://www.php.net/manual/en/timezones.php and select your desired time zone.

Return to the Options tab and add the timezone to the field.

The system will auto-save the changes.

Here is a video on how to make these changes for your hosting account using PHP Selector or MultiPHP INI Editor for cPanel:

PHP Timezone Change Using PHP Selector or cPanel’s MultiPHP INI Editor

Setting Timezone For Upstream Supported PHP (eaPHP):

For customers using upstream or regular PHP, log in to cPanel.

Scroll down to Software and click the “MultiPHP INI Editor“.

Before proceeding, there are a couple of things to bear in mind.

You need to be super careful with the changes you are making as an error could result in non-functional PHP scripts.

cPanel does not allow the use of these directives in PHP settings:

  • null
  • yes
  • no
  • true
  • false
  • on
  • off
  • none

cPanel does not allow these special characters in any directives you are adding:

?{}|&~![()^" 

If you are not sure what to do, please explain as precisely as possible your goal so our team can help make the adjustments.

From the menu, select the location you are making the changes.

This either can be your account’s home directory or a particular domain’s document root.

Use the “Editor Mode” tab for the version of PHP and update the PHP “date.timezone” value to your desired timezone.

For example:

date.timezone = America/New_York

Click “Save“.

The system will save the changes to your domain’s php.ini file, the user.ini file, and .htaccess file.

Once done, please do notify our technical support team so the necessary update can be made for the changes to take effect.


Posted

in

by

Tags: