PHP Configuration: It Is Not Safe to Rely on the System's Timezone Settings

date(): It is not safe to rely on the system's timezone settings...

You probably need to put the timezone in a configuration line in your php.ini file. You should have a block like this in your php.ini file:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

If not, add it (replacing the timezone by yours). After configuring, make sure to restart httpd (service httpd restart).

Here is the list of supported timezones.

PHP Warning: date(): It is not safe to rely on the system's timezone settings. - OS X

You need to set the time zone, either using php.ini or with the php function date_default_timezone_set().

Via php.ini:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/London

Or using php:

date_default_timezone_set("Europe/London");

It is not safe to rely on the system's timezone settings

In php.ini, ; comments out a line, so ;date.timezone = "Europe/Lisbon" does nothing. Uncomment that line by removing that preceding ; and restart Apache.

PHP - It is not safe to rely on the system's timezone settings

Any ideas how to stop this.

The error message tells you how to stop this.

You are required to use the date.timezone setting or the date_default_timezone_set() function.

Update your PHP installation's php.ini (likely /etc/php.ini) file to have a date.timezone setting, or use date_default_timezone_set() in your scripts.

You're only now seeing this because it starts happening in PHP 5.3+.

PHPMailer date_default_timezone_get(): It is not safe to rely on the system's timezone settings

PHP does not have a default timezone set.

Before using PHPMailer (or any class that makes use of time zones) you should configure PHP by setting date.timezone in PHP.INI

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = 'Australia/Sydney'

or by calling the date_default_timezone_set() function in yout code (before PHPMailer)

date_default_timezone_set('Australia/Sydney');

or in apache's configuration files (my preferred method)

# Timezone and other stuff for PHP
php_value date.timezone "Australia/Sydney"


Related Topics



Leave a reply



Submit