PHP Issue - Fatal error: date(): Timezone database is corrupt - this should *never* happen!
-
Howdy,
I have two Omega's with the same issue and I've googled my butt off and given up. Hence I'm looking for help or a nudge on where to report this as a bug.
Install PHP on the Omega (opkg install php5 php5-cli) and run this code in a file called "test.php":
<?php
$timenow = date("Y-m-d-H-m-s");eg "php-cli test.php" in the terminal.
And you'll receive back this message:
Warning: date(): Invalid date.timezone value 'UTC', we selected the timezone 'UTC' for now. in /www/php/test.php on line 2
Fatal error: date(): Timezone database is corrupt - this should never happen! in /www/php/test.php on line 2I've tried every setting I can think of date_default_timezone_set(), ini_set() to set the values & date.timezone and still the same results.
I've had to hack a quick function to read the date off the system time/date for now. But it's annoying I can't use the date() function at all
Any ideas!?
Matt
PS: running date on the command line returns:
root@Omega-AAAA:/www/php# date
Wed Mar 16 15:42:21 GMT 2016
-
Hi Matt,
you have to install timezone package first:
$ opkg install zoneinfo-europeyou can get the available list with
$ opkg list|grep zoneinfoThan you can set up the php timezone, I prefer to add "date.timezone = 'Europe/Rome'" in /etc/php.ini in the "Data" section.
I hope this will help you
Manuel
-
@Manuel-Baldassarri said:
Hi Matt,
you have to install timezone package first:
$ opkg install zoneinfo-europeyou can get the available list with
$ opkg list|grep zoneinfoThan you can set up the php timezone, I prefer to add "date.timezone = 'Europe/Rome'" in /etc/php.ini in the "Data" section.
I hope this will help you
Manuelecho date("d-M-Y");
29-Mar-2016
Amazeballs!
Thanks for that info Manuel, that resolved it! Thank you
Matt
-
Howdy Manuel,
https://github.com/moggiex/wiki/blob/patch-11/Tutorials/PHP-Date-Time-Functions.md
I've whipped together a quick tutorial on this as I could not find the answer to this anywhere on the interwebs at all & had given up.
Thanks again!
Matt
-
Thanks! I just experienced this problem. I was about to post a new topic, but your solution saved me. I did
opkg install zoneinfo-europe
.It was weird. My code was working fine, then suddenly stopped. I wonder if it was to do with the timezone change to BST here in the UK at the weekend?