I got this error when I requested to update the PHP version from 5.2.17 to PHP 5.3.21 on the server.
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: date(): 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. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead</p>
<p>Filename: libraries/Log.php</p>
<p>Line Number: 86</p>
</div>
Warning: date(): 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. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /filelocation right here/system/libraries/Log.php on line 86
Warning: date(): 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. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /filelocation right here/system/libraries/Log.php on line 99
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: date(): 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. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead</p>
<p>Filename: libraries/Log.php</p>
<p>Line Number: 99</p>
</div>
I had this error running php-fpm in a chroot jail. I tried creating etc/php.ini and /usr/share/zoneinfo in the chroot directory, but it just didn't work. I even tried strace-ing the php-fpm daemons to see what file they were missing - nothing jumped out.
So in case Google brings you here because you get this error when using php-fpm configured for chroot, you can probably fix it by adding this line to
/etc/php-fpm.d/www.conf
in the ENV section:A php-fpm restart is normally required for it to take effect. Hope this helps somebody out there.
@Justis pointed me to the right direction, but his code did not work for me. This did:
Documentation: http://www.php.net/manual/en/function.date-default-timezone-get.php
This solution is not only for those who does not have full system access. It is necessary for any script when you provide it to anyone else but you. You never know on what server the script will run when you distribute it to someone else.
In addition to setting the date.timezone= as mentioned in several answers, I found an error in the php.ini file that was keeping it from getting to the date.timezone. The way I found it was by running php from the command line in a terminal. this caused an error to be reported at line 114. In my case I had uncommented a setting for displaying errors that had '|' between 2 values. It did not like it. I removed one of the values and the | and everything was good after that
This is an easy solution for whom doesn't know the timezone.
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: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.
I am hosting my EC2 and S3 bucket in us-west-2 (Oregon) region. When I was calling
$s3client->listBuckets()
to list existing buckets in my php, I was getting exception -"Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings...".
I made below changes to make it work. Sharing these details in case someone is facing similar issue and any of above answers have not helped.ntpstat
command. If you get error, this link helps you to know what is going wrong.date.timezone
was not set to any value and also it was commented by default. I un-commented by removing ';' before this line and set its value to"UTC"
and saved the file.sudo service httpd restart
andsudo service ntpd restart
commands.After this I am able to list buckets successfully without any exception. Hope this helps.