PHP, MySQL and Apache are all on the same server i.e. localhost Ubuntu.
System:
$ php -r 'echo date("Y-m-d H:i:s")."
";';
2015-07-04 16:47:24
mysql server:
SELECT NOW(); // 2015-07-04 16:47:24`
DESCRIBE users
# Field, Type, Null, Key, Default, Extra
'created_at', 'datetime', 'NO', '', '0000-00-00 00:00:00', ''
'updated_at', 'datetime', 'NO', '', '0000-00-00 00:00:00', ''
PHP /etc/php5/cli/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Europe/London"
; http://php.net/date.default-latitude
;date.default_latitude = 31.7667
; http://php.net/date.default-longitude
;date.default_longitude = 35.2333
; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333
; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333
Why then does:
$ php artisan db:seed
using:
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call(UserTableSeeder::class);
DB::table('users')->insert([
'name' => str_random(10),
'email' => str_random(10).'@gmail.com',
'password' => bcrypt('secret'),
'created_at' => date("Y-m-d H:i:s"),
'updated_at' => date("Y-m-d H:i:s")
]);
Model::reguard();
}
}
insert records into the database only with the dates an hour behind? See:
It's a mystery.
More info:
$ php -i | grep 'Loaded Configuration File'
Loaded Configuration File => /etc/php5/cli/php.ini
And:
$ timedatectl
Local time: Sun 2015-07-05 07:14:31 BST
Universal time: Sun 2015-07-05 06:14:31 UTC
RTC time: Sun 2015-07-05 06:14:31
Time zone: Europe/London (BST, +0100)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2015-03-29 00:59:59 GMT
Sun 2015-03-29 02:00:00 BST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2015-10-25 01:59:59 BST
Sun 2015-10-25 01:00:00 GMT