Article

  • 1 year

    1 year

    YetiShare / Core

    481

Sync Date/Time Across PHP, MySQL & Linux

For Linux:


  • Open the /etc/sysconfig/clock file with your favorite text editor (such as vim or nano). ...
  • Locate the ZONE entry, and change it to the time zone file. List of timezones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones i.e:
    • ZONE="Europe/Amsterdam"
  • Save the file and exit the text editor.

For PHP:


  • Open your php.ini file for editing. Possibly in /etc/php.ini.
  • Locate date.timezone = and add your timezone as above. i.e.
    • date.timezone = "Europe/Amsterdam"
  • Save and restart PHP / your web server.

For MySQL:


  • Open your my.cnf file for editing. Possibly in /etc/my.cnf.
  • After the [mysqld] section add:
    • default-time-zone = '+02:00'
  • Adjust the +02 depending on your preferred timezone.
  • Save and restart MySQL.