![]() |
Error : Strict Standards: date() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Error : Strict Standards: date() (/showthread.php?tid=63365) |
Error : Strict Standards: date() - ComputingFroggy - 10-22-2015 Hi, There's still a bug in the latest CI (v. 3.0.2) that was in v. 2.1.4: an error with the timezone. When I run CI straight out of the box, if I have the log threshold to anything above 1, I get a page full of error like this one: Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in home/htdocs/system/core/Log.php on line 176 (at least 15 times) I know the way to fix this is to set the timezone in index.php: if(ini_get('date.timezone') == '') { date_default_timezone_set('Europe/Paris'); } or to whatever timezone you like from the PHP doc. But I would have thought that would be fixed in this release of CI ! ! Cheers, L@u RE: Error : Strict Standards: date() - Narf - 10-22-2015 You have to set your timezone in your php.ini file. It's not a bug and CI cannot do that for you because it couldn't possibly know which timezone you're in. If that was possible, PHP itself would do it instead of giving you a warning. RE: Error : Strict Standards: date() - Martin7483 - 10-23-2015 You could also run into this issue when running your website on a shared hosting. Not all hosting providers have the timezone set in php.ini I have seen this on a few different hosting providers. I just add this at the top of the index.php file PHP Code: /* RE: Error : Strict Standards: date() - ComputingFroggy - 10-25-2015 @Martin7483: that's what I said in my first post. @Narf: OK, I understand that's something that should be done at server level but all (shared) hosting I've used, don't do it, so may be, it should be added in the documentation/tutorial ! RE: Error : Strict Standards: date() - InsiteFX - 10-25-2015 Just add it to the top of your index.php file like most of us do. I did that with CI 2.1.4 at the beginning. RE: Error : Strict Standards: date() - mwhitney - 10-26-2015 Most of the PHP code I've seen which has to deal with timezones at some point includes something to set the default timezone to UTC or a developer-provided value. I eventually just dumped something into Bonfire's index.php to set it to UTC if it couldn't get a default from a couple of other sensible locations (ini_get('date.timezone') or date_default_timezone_get()). I tried to find the exact code I used as the basis for what's in Bonfire, but at this point it looks like Composer and PyroCMS don't bother checking under most conditions and just set it, expecting the developer to change it in the code as needed. |