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
How to Implement a Good Profanity Filter
Convert Seconds to Hour:Minute:Second
How Can One Check to See If a Remote File Exists Using PHP
Redirect All to Index.PHP Using Htaccess
Many-To-Many Relationships Examples
Forcing to Download a File Using PHP
How to Use Store and Use Session Variables Across Pages
How to Check If a Url Exists Via PHP
How to Zip a Whole Folder Using PHP
How to Log Errors and Warnings into a File
What's Wrong With Using $_Request[]
How to Validate an Email in PHP
Call to a Member Function Bind_Param() on a Non-Object
Is "MySQLi_Real_Escape_String" Enough to Avoid SQL Injection or Other SQL Attacks
Formatting a Number With Leading Zeros in PHP
How to Validate an Email Address in PHP
Can PHP Curl Retrieve Response Headers and Body in a Single Request