I got this error when I requested to update the PHP version from 5.2.17 to PHP 5.3.21 on the server.
I always keep this line inside codeigniter's root index.php
.So that my code works at any server
date_default_timezone_set('Asia/Dhaka');
List of Supported Timezones here
In your connection page put a code like this date_default_timezone_set("Africa/Johannesburg");
based on your current location.
If you using Plesk, try it, First, Open PHP Settings, at the bottom of page, change date.timezone from DEFAULT to UTC.
Add the following in your index.php
file. I first came across this when I moved my application from my XAMPP server to Apache 2.2 and PHP 5.4...
I would advise you do it in your index.php
file instead of the php.ini
file.
if( ! ini_get('date.timezone') )
{
date_default_timezone_set('GMT');
}
You can set the timezone in your .htaccess
file
php_value date.timezone UTC
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