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
MySQL - Count Total Number of Rows in PHP
Using Strtotime for Dates Before 1970
Chaining Static Methods in PHP
Php: Check If a File Is Loaded Directly Instead of Including
Replace Multiple Newlines, Tabs, and Spaces
Transpose 2D Array, Join Second Level with Commas, and Join First Level with Pipes
PHP Array_Filter with Arguments
PHP Exec() as Background Process (Windows Wampserver Environment)
Using X-Sendfile with Apache/Php
What's an Actual Use of Variable Variables
Cloudflare and Logging Visitor Ip Addresses via in PHP
File_Get_Contents Returns 403 Forbidden
How to Check If a Row Exist in the Database Using Pdo
Why Does the Laravel API Return a 419 Status Code on Post and Put Methods