"Date(): 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");

Symfony2 and date_default_timezone_get() - It is not safe to rely on the system's timezone settings

Maybe you are trying to set it in Apache's php.ini, but your CLI (Command Line Interface) php.ini is not good.

Find your php.ini file with the following command:

php -i | grep php.ini

And then search for date.timezone and set it to "Europe/Amsterdam". all valid timezone will be found here http://php.net/manual/en/timezones.php

Another way (if the other does not work), search for the file AppKernel.php, which should be under the folder app of your Symfony project directory. Overwrite the __construct function below in the class AppKernel:

<?php     

class AppKernel extends Kernel
{
// Other methods and variables


// Append this init function below

public function __construct($environment, $debug)
{
date_default_timezone_set( 'Europe/Paris' );
parent::__construct($environment, $debug);
}

}

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