timezone with the /go/timezone Command

/go/timezone keeps the operating system and PHP on the same timezone. In one run it: You can give a timezone name, or run the command with no arguments and let it detect one. Automatic detection uses the IP address of the most recent login to the server, not the server's own location. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Set a specific timezone
/go/timezone Europe/London

# Detect the timezone from the last login IP
/go/timezone

Options

Argument Required Default Notes
<timezone> No Detected automatically A timezone name such as Europe/London or America/New_York. List the valid names with timedatectl list-timezones.

[!IMPORTANT]
A timezone you pass is not checked before PHP is updated. A mistyped name (for example Londn) is written to the php.ini files, and only then rejected by timedatectl. The command still prints the success message, so check it carefully.

Examples

# Set the timezone to New York
/go/timezone America/New_York

# Set it to UTC
/go/timezone UTC

# Detect it from the last login
/go/timezone

# Find a valid name, then check the results
timedatectl list-timezones | grep -i dubai
timedatectl
php -i | grep date.timezone

Output

With automatic detection, the command first prints what it found:

Country: GB
Timezone: Europe/London
Local timezone has been set to Europe/London.

With a timezone name, only the last line is printed (followed by any output from fpm).

Outcome What you get
Timezone set Local timezone has been set to <timezone>.
Detection failed Can't set time zone automatically. Exit status 1.
Unsupported OS Unknown operating system. Nothing is changed in PHP or the system.

Every run is logged to /var/log/go/timezone.log with a timestamp and the arguments used.

See the full reference at /go/timezone and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *