timezone
Set the timezone of the server and of PHP, either by name or detected automatically from your last login IP
- Command:
/go/timezone - Category: System
- Required option: None
- Output: Plain text
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/timezone keeps the operating system and PHP on the same timezone. In one run it:
- sets
date.timezonein every PHP configuration file on the server - sets the system timezone with
timedatectl - updates the timezone of the GoAdmio panel's own PHP pool
- refreshes GoAdmio's timezone data (see
dst) - reloads PHP-FPM so the change takes effect
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.
Quick start
# Set a specific timezone
/go/timezone Europe/London
# Detect the timezone from the last login IP
/go/timezone
Syntax
/go/timezone [<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 thephp.inifiles, and only then rejected bytimedatectl. The command still prints the success message, so check it carefully.
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.
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
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Can't set time zone automatically. |
ipinfo.io can't be reached or returned no timezone, or the last login wasn't from a public IP address (for example a console login). |
Pass the timezone name yourself. |
| The detected timezone is wrong | The detection uses whoever logged in last, possibly through a VPN, or another administrator. | Pass the timezone name yourself. |
Unknown operating system. |
The OS isn't AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, or Ubuntu. | Set the timezone by hand. |
Failed to set time zone: Invalid time zone followed by "has been set" |
The name you passed isn't valid. | Run the command again with a valid name. The php.ini files are overwritten the second time. |
Permission denied when a php.ini is edited |
The command wasn't run as root. | Run it as root. |
| PHP still shows the old timezone | A site sets its own (in ini_set(), .user.ini, or a pool setting), a php.ini line has unusual spacing so it wasn't replaced, or PHP-FPM wasn't reloaded. |
Check the file with php -i, edit it by hand, and run /go/fpm --reload. |
| Database times didn't change | Some services read the system timezone only when they start. | Restart MariaDB. |
| A country was marked as whitelisted | This happens the first time automatic detection runs. See Details. | Review the list with your GoAdmio country settings. |
Details
How it works
flowchart TD
A["/go/timezone"] --> B{"Timezone given?"}
B -- "No" --> C["Find the last login IP, look it up on ipinfo.io"]
C --> D{"Found Area/City?"}
D -- "No" --> X["Can't set automatically, exit 1"]
D -- "Yes" --> E["Save the country on the first run"]
B -- "Yes" --> F
E --> F{"Supported OS?"}
F -- "No" --> Y["Unknown operating system"]
F -- "Yes" --> G["Update every php.ini"]
G --> H["timedatectl set-timezone"]
H --> I["Update the panel pool and timezone data"]
I --> J["Reload PHP-FPM"]
Automatic detection
- Takes the IP address from the first line of
last(the most recent login). - Asks
ipinfo.ioabout that IP and saves the answer to/usr/local/goadmio/tmp/ip.info. - Reads the country and timezone from the answer. The timezone must contain a
/, such asEurope/London, or detection fails. - If
/etc/countrydoesn't exist yet, writes the country code to it and setsWhitelist=1for that country in/var/lib/sqlite/country.db.
Step 4 runs only once, the first time detection succeeds. It also happens before the OS check, so it can happen even if the OS turns out to be unsupported.
Detection sends the login IP address to the third-party service ipinfo.io.
PHP files updated
Only files that exist are edited.
| OS | Files |
|---|---|
| AlmaLinux, Rocky, CentOS, Red Hat, Fedora | /etc/php.ini and /etc/opt/remi/<version>/php.ini for every installed version |
| Debian, Ubuntu | /etc/php.ini and /etc/php/<version>/fpm/php.ini, cli/php.ini, and apache2/php.ini for every installed version |
In each file:
- If an active
date.timezoneline exists, it is replaced withdate.timezone = "<timezone>". - Otherwise the line is added at the end of the file. A commented-out
;date.timezoneline is left as it is.
Settings that a site makes itself (ini_set(), .user.ini, or its own pool) still override these values.
Other steps
timedatectl set-timezone <timezone>sets the system timezone./go/php-fpm go goupdates the timezone of the panel's own PHP pool./go/dstrefreshes the timezone data./go/fpm --reload "| Executed by timezone"reloads PHP-FPM.
Files and requirements
| Item | Used for |
|---|---|
/usr/local/goadmio/tmp/ip.info |
The answer from ipinfo.io. |
/etc/country |
The country saved on the first automatic detection. |
/var/lib/sqlite/country.db |
The country whitelist. |
/var/log/go/timezone.log |
The command log. |
curl, sqlite3, timedatectl |
Detection, the country database, and the system timezone. |
| Root access | Editing the php.ini files. |
See also
| Command | Description |
|---|---|
dst |
Provide timezone definitions, DST rules, and historical changes |
fpm |
Restart all installed PHP-FPM versions on your server |
maxexecutiontime |
Change the max execution time for all PHP versions |
memorylimit |
Change the PHP memory limit for all PHP versions |
errorreporting |
Read or set PHP error_reporting across all php.ini files |
displayerrors |
Toggle PHP display_errors across all php.ini files |