views:

46

answers:

2

When checking php.ini, from both phpinfo and php -i on the command line, my timezone is set to Africa/Johannesburg. So my timezone is GMT +2.

I wrote a tiny snippet to check the time is right as follows:

echo date('h:i A', time());
echo '<br />' . ini_get('date.timezone');

and this outputs the correct time, matching with my localmachine's system time.

However, when I look at my php error log, the time on each error log item is behind by exactly two hours? Why is this, and how can I fix this.

Also having issues with Zend Cache, and i think this time issue is causing it.

A: 

Google-fu: read what the PHP official site writes.

Iacopo
This is probably not it: His system time zone is set correctly.
Pekka
+1  A: 

It sounds like PHP is configure with one timezone, and the server it is running on is set to a different time zone (possibly GMT / UTC). This means all file operations etc will be working on a different timezone to your PHP scripts.

Check the system timezone of your server.

rikh
Could it be because PHP is using GMT and Windows 7 is using UTC?
Joe Zephyr