PHP - It is not safe to rely on the system's timezone settings.
Error: PHP - It is not safe to rely on the system's timezone settings.
You get the following warning when you run a PHP script:
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.
First find out your system's timezone. On Debian/Ubuntu, it's in /etc/timezone:
root@server1:~# cat /etc/timezone
On Fedora/CentOS/RedHat, it's in /etc/sysconfig/clock:
[root@server1 ~]# cat /etc/sysconfig/clock
Open your php.ini. On Debian/Ubuntu, it's /etc/php5/apache2/php.ini:
On Fedora/CentOS/RedHat, it's /etc/php.ini:
Find the date.timezone line, make sure it is not commented out and has the correct timezone for your system:
Restart Apache afterwards:
On Debian/Ubuntu, you run:
On Fedora/CentOS/RedHat, you run:
If you don't have access to your system's php.ini, you can set the default timezone at the beginning of your PHP scripts as follows:
<?php date_default_timezone_set("Europe/Berlin"); [...] ?>