Setup - Dictionaries with timezone not set

/dolibarr/admin/dict.php?mainmenu=home

gives an error when the Timezone is not set in php.ini:

[Tue Mar 28 14:04:32.836707 2017] [:error] [pid 7277:tid 140651110819584] [client 192.168.0.151:58982] PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in <PATH>/dolibarr/core/lib/date.lib.php:129\nStack trace:\n#0 <PATH>/dolibarr/core/lib/date.lib.php(129): DateTime->__construct()\n#1 <PATH>/dolibarr/core/modules/modAdherent.class.php(333): dol_time_plus_duree(1490702672, 1, 'y')\n#2 <PATH>/dolibarr/core/lib/admin.lib.php(952): modAdherent->__construct(Object(DoliDBPgsql))\n#3 <PATH>/dolibarr/admin/dict.php(501): complete_dictionary_with_modules(Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array, Array)\n#4 { in <PATH>/dolibarr/core/lib/date.lib.php on line 129, referer: https://<HOST>/dolibarr/admin/modules.php?mainmenu=home

While I am aware this is my fault for forgetting to set that on this box, maybe the error should be cought and that message displayed in the browser.

Also I reocmmend that maybe the install script checks if the timezone i set in php.ini so this doesn’t happen in the first place? (also during update of course)

this error did not occur on 4.0.4 as far as i remember

Hi,
got the same error, and set date.timezone value in php.ini , and error disappears

I did the same. in php ini I have added
date.timezone=“Asia/Dubai”
then I have created a php script in the root directory of my webserver with the following content.
<?php
phpinfo();
?>

I named it phpinfo.php

then I called it throu the browsers and got correct valued=s from server.

as you can see everything is ok. but I still get

what to do to solve it?
please Help

You probably not edit the php.ini that is used by apache.
Check into dir /etc/php5/apache/

where is no such folder.my /etc/ is empty. and /php/ is in same directory as /etc/
php.ini is in public_html.

Pièces jointes :

from Dolibarr About PHP menu, I can see that php.ini has been loaded from /opt/php56/lib/php/php.ini
I don’t have this directory. or file

I has able to fix the issue with the help of hosting provider’s support.
it appears that dolibarr is looking for php.ini in provider’s set directory, which for security reasons is not available for modification but ther’s a way to enable recursive php.ini.
what does that mean? just by typing something in htaccess file php starts looking for php.ini in all folders.
This is a link

something to Dolibarr developers also.
before fixing with above method I checked with phpinfo() function and Dolibarr’s Admin Tools->about PHP menu.
both returned different values for Loaded Configuration File.
it seems to be a bug. and please implement timezone in Dolibarr per user rather than server’s whiting php.ini.

I hope it will help

1 Like

Incredible!, All Dictonaries and permissions issues were solved by going to:
PHP Selector | extensions in my cpanel

After that,
Switch To PHP Options

date.timezone reset to the server.

See the link below

TimeZone PHP (server)