DrewPH Posted February 12 Share Posted February 12 This refers to the issue posted here: https://processwire.com/talk/topic/30845-solved-database-time-vs-php-time/ However I've posted a new topic because the above topic was marked solved by the OP. I'm getting the same error: Warning, the database time differs from PHP time by 8 hours. 2025-02-12 09:51:44 - database time 2025-02-12 17:51:44 - PHP time Please edit your /site/config.php file and update your $config->timezone to match that of your database. See PHP timezones list My MySQL installation has to remain set to UTC, because it serves various sites in various timezones. I learned here: https://stackoverflow.com/questions/19023978/should-mysql-have-its-timezone-set-to-utc/19075291 that I can set the session timezone in MySQL, with this command, which I think will solve my problem: SET @@session.time_zone = "+08:00"; My question is, from which ProcessWire file should I execute this, in order for it to prevent the above warning? site/templates/_init.php or somewhere else? Thanks in advance. Link to comment Share on other sites More sharing options...
Gideon So Posted February 12 Share Posted February 12 Hi @DrewPH Put the following line into your config.php $config->dbInitCommand = "SET NAMES '{charset}', time_zone = '-08:00' "; Adjust the timezone according to your need. Gideon 3 Link to comment Share on other sites More sharing options...
DrewPH Posted February 13 Author Share Posted February 13 So the correct place is config.php - thanks very much, will try this. Link to comment Share on other sites More sharing options...
DrewPH Posted February 14 Author Share Posted February 14 I found that all I needed at the end of my config.php was $config->dbInitCommand = "SET time_zone = '+08:00' "; and all is good, warning gone. Thanks again. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now