Time Differences between PHP and MySQLDistributed Systems with Node.js, O'Reilly 2020, has been published!
Here's an interesting observation I've just made while working on the NeoInvoice project… These are the results of running PHP's date() function on the current time, along with the result of running MySQL's SELECT NOW() function:
Windows Dev Server:
PHP Time : 2010-06-13 14:24:58 MySQL Time: 2010-06-13 14:24:34
Linux Staging Server:
PHP Time : 2010-06-13 14:24:58 MySQL Time: 2010-06-13 14:24:58
The differences between PHP/Apache's time and MySQL's time on Windows is an entire 24 seconds! This is consistent as well, after reloading the script several times, we still get the same 24 second different offset. Linux consistently has a zero second difference.
For the scholars out there, the Windows server is running APC, and the Linux server is running eAccelerator. Here's the script we used for timing (you'll want to replace the runQuery() function to reproduce):
<?php require_once("config-mysql.php"); $result = runQuery("SELECT NOW() AS mysql_time"); $row = mysql_fetch_assoc($result); $mysql_time = date("Y-m-d H:i:s", strtotime($row['mysql_time'])); $php_time = date("Y-m-d H:i:s"); ?> <pre> PHP Time : <?=$php_time?> MySQL Time: <?=$mysql_time?> </pre>