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
- Find the active
php.ini
file:PHP_INI=$(php -i | grep /.+/php.ini -oE)
- Check the current timezone setting in PHP:
egrep date.timezone $PHP_INI
- 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. - 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
- Reload Apache to apply the PHP changes:
systemctl reload httpd
- Update the system timezone:
rm -f /etc/localtime ln -s /usr/share/zoneinfo/${country}/${city} /etc/localtime
- 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.