Jump to content

Recommended Posts

Is there a way via php script to sync a servers time?  I have a dedicated server on a webhost and I can go in a sync it manually, but I would really rather not have to remember to do that every so often.  I have read that a NTP can be setup, but I have zero knowledge of doing command line stuff like all the examples show to do.  I was hoping for a php version of code that could accomplish the same thing.

 

The reason I need to make sure it's synced is I ran into an issue with a Google API last night that stopped allowing me to authorize cause the time Google saw was not within range of what it wanted.  Once I synced the server time, it let me authorize with the API.  I don't want my website to break periodically if I forget to sync the time, so an automatic sync would certainly be best.

Link to comment
https://forums.phpfreaks.com/topic/296719-keping-server-time-synced/
Share on other sites

Rather than use the hammer you know to hammer in a screw, learn to use a screwdriver.

 

Install ntp/ntpd/whatever the name of the package is called on your (presumably Linux) distro. And make sure the system is using the right timezone. That's it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.