I am trying to 'fix' bandwidthd-php on my OpenWRT router. I am running OpenWrt 22.03.3 r20028-43d71ad93e / LuCI openwrt-22.03 branch git-23.069.50944-cd8bea9 on x86/64.
I have installed: bandwidthd-php, php8, php8-cgi, php8-cli, php8-mod-gd, php8-mod-intl, php8-mod-pgsql, zoneinfo-*
PHP gives many warnings and errors when executing the scripts. I am resolving them by improving the PHP code and replacing obsolete functions by better implementation.
One of these is using (either of):
//$formatter = new IntlDateFormatter('en_US', IntlDateFormatter::FULL, IntlDateFormatter::NONE, // 'Europe/Amsterdam', IntlDateFormatter::GREGORIAN); $formatter = new IntlDateFormatter('en_US', IntlDateFormatter::FULL, IntlDateFormatter::NONE); return $formatter->format($tm);
When I execute php-cgi debug_graph.php
(I created this file to set the url parameters for graph.php and call that file)
(in graph.php I use IntlDateFormatter)
I get the error:
Fatal error: Uncaught IntlException: datefmt_create: No such time zone: 'Europe/Amsterdam': U_ILLEGAL_ARGUMENT_ERROR in /www/bwd/graph.php:88
Stack trace:
#0 /www/bwd/graph.php(88): IntlDateFormatter->__construct('en_US', 0, -1)
#1 /www/bwd/graph.php(331): FmtTime(1680040800)
#2 /www/bwd/debug_graph.php(10): include('/www/bwd/graph....')
Running the same script on a windows or ubuntu system with php8 works fine. I do have the zoneinfo-* packages installed. What can be missing?