Issue
- The time of PHP scripts does not coincide with the system time
System date:
# date
Mon Sep 5 14:31:03 -04 2022But PHP script returns incorrect time zone and time:
<?php echo "The time in " . date_default_timezone_get() . " is " . date("H:i:s"); ?>
The time in America/Santiago 03:30:50 pm
As can be seen, the time differs in one hour.
Environment
- Cloudlinux PHP selector
- alt-php**-pecl extension
Solution
Ensure that timezone DB is up-to-date using the following command:
/opt/alt/php72/usr/bin/pecl upgrade timezonedb
If it did not help, reinstall timezonedb
php extension:
# /opt/alt/php74/usr/bin/pecl uninstall timezonedb
# /opt/alt/php74/usr/bin/pecl install timezonedb
Also, be sure to enable the extension for the user:
# selectorctl -u USER -v VERSION -e timezonedb
Where "USER" must be replaced with the username, and "VERSION" with the specific PHP version.
Cause
Outdated "timezonedb" content.
Comments
0 comments
Please sign in to leave a comment.