How do I set date.timezone?

On the first setup screen for icingaweb2 I’m getting the error: “The PHP config `date.timezone’ is not defined.”

When I set the variable in the php.ini file, and then view phpinfo, it shows me that the default timezone is set, but the variable date.timezone is empty. See the image:

I can change the value of the default timezone by changing date.timezone in the php.ini file. Currently mine reads: date.timezone = "America/Los_Angeles" I can see the result in the default timezone. I can also change it in .htaccess by adding php_value date.timezone "America/Los_Angeles". But the value of date.timezone always remains “no value”. I’ve tried other values in both places and I can see them reflected the default timezone field. But never in the date.timezone field.

Additional ini files evaluated do not have date.timezone values in them as I grepped the lot of them. date.timezone is only found in the main php.ini file in /etc/php/7.3/apache2/php.ini.

Despite the default timezone being set correctly, icinga2 expects the date.timezone variable to be set. Does anyone know how to set the variable?

I solved this with a hack. I edited /usr/share/php/Icinga/Application/webrouter.php.
I added the line:

ini_set(‘date.timezone’, ‘America/Los_Angeles’);

I would like to request that a line be added to the startup procedures to check php’s default timezone and use that if available before throwing an error. My system is debian buster (10.0.xx). Setting date.timezone in php.ini only sets the default timezone, not date.timezone.


depending on which kind of php you installed (PHP, PHP-FPM), you have to edit the right php.ini. Because every installation read there own ini.file. In your phpinfo-output there you should see which php.ini is loaded. Like by us:
image . These lines you’ll find at the beginning of the output.

That mean normally you don’t need this hack. And it’s also better to do this change in the php.ini file. Because if there is an update for the Icingaweb and it’s framework, your changes will be overwritten.

I’ve got the correct php.ini file. When I change date.timezone in php.ini, I can see the change reflected in phpinfo as “Default timezone”. But date.timezone doesn’t change. And the error continues to register.

You bring up an excellent point. I just don’t know how to get around it. I spend about 10 hours trying to get past the opening setup screen. Somehow php isn’t getting the message on date.timezone even though that’s the variable I’m changing. But it only reflects on “Default timezone”.

I’ve got a question in at “AskUbuntu” at stack exchange as well. This appears to be a php question. I just thought maybe someone else had run into it in the Icinga communicty.

Looks like you’re using redhat or centos there. I think you want to edit this file:


I notice in your earlier post you were editing the one in the Apache folder instead of the one displayed on that screen there. icingaweb pulls in a separate php when you install it.