Adilson Magnus
Commercial Support

Hey there, our support is exclusive via Telegram, click on the bellow icon and start chat now.

Mon-Fri: 9:00–19:00 (GMT-03:00)

How to Configure PHP and System Timezone via Command Line in MagnusBilling

When setting up a MagnusBilling server, it's important to make sure that both your PHP environment and your Linux system use the correct timezone. This guide explains how to configure the timezone step by step via the command line.

🎯 Objective

Update and synchronize the timezone settings in both PHP and the Linux system to ensure consistency in date and time across your application and logs.

🔧 Step-by-Step Instructions

  1. Find the active php.ini file:
    PHP_INI=$(php -i | grep /.+/php.ini -oE)
  2. Check the current timezone setting in PHP:
    egrep date.timezone $PHP_INI
  3. Set your desired timezone (e.g., Asia/Almaty):
    country=Asia
    city=Almaty

    Sets the target timezone to Asia/Almaty. You can find the full list of available timezones by running:
    timedatectl list-timezones on your server, or by checking the official list at: Wikipedia – List of tz database time zones.

  4. Update php.ini with the new timezone:
    sed -i 's/date.timezone.*/date.timezone = '$country'\/'$city'/' $PHP_INI
    sed -i 's/;date.timezone.*/date.timezone = '$country'\/'$city'/' $PHP_INI
  5. Reload Apache to apply the PHP changes:
    systemctl reload httpd
  6. Update the system timezone:
    rm -f /etc/localtime
    ln -s /usr/share/zoneinfo/${country}/${city} /etc/localtime
  7. Verify the PHP timezone setting again:
    egrep date.timezone $PHP_INI

✅ Notes

  • These commands require root or sudo privileges.
  • If you're not using Apache, replace systemctl reload httpd with your web server's reload command (e.g., systemctl reload php-fpm).
  • Compatible with most Linux distributions (e.g., CentOS, RHEL, Ubuntu).

If you need assistance applying these changes on your MagnusBilling server, feel free to contact our support team.