PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, January 31, 2022

[FIXED] Laravel 5.1 Timezone unsynced with PHP after server shut down and re-start - command line re-set

 January 31, 2022     apache, laravel-5.1, mysql, phpmyadmin, ubuntu-14.04     No comments   

Issue

I am having problems with PHPMyAdmin and Laravel 5.1 on a Ubuntu 14.04 virtual server, whenever I shut the server down the timezone (date and time) slips back by the amount of time the server has been shut down for.

I've set the timezone in both php.ini on the server and app.php in Laravel to

 'timezone' => 'Australia/Sydney',

Does anyone know a command line command that I can execute for re-setting the time back to the above when the virtual server is re-started?


Solution

After struggling with the date and time being in-sync sometimes and not other times, I've discovered that the following steps do reset the time to the correct time. In the database in PhpMyAdmin, click the SQL tab and run the following SQL query

SELECT @@global.time_zone, @@session.time_zone;

Then back in the VirtualBox command line switch to 'root' user, run the following command

set default-time-zone

Then reboot the server

sudo reboot

When it re-boots you should have the correct time and date displayed, you may need to go through the last two steps a couple of times to get the correct time and date, and check the ip address as it may have changed

ifconfig

Hope this helps somebody else



Answered By - zod
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing