# php logs: clocks problems



## clinty (Oct 19, 2009)

Hello.

I use :
FreeBSD 6.4
apache-itk-2.2.13
php5-5.2.11

For few times, I have a strange problem with php log... There are written with 2h of delay.


```
[19-Oct-2009 13:42:54] PHP Notice:  Undefined variable: selected in /var/www/sites/site1/www/admin/index.php on line 5
```

This error has been written on 19-Oct-2009 15:42:54.

I do not understand why there is this delay.

ALL my services work, no time problems. All logs are ok, with syslog or not. In PHP, a echo date('l jS \of F Y h:i:s A'); prints the true date.

I'm looking for a solution for this 'strange' problem, and why, just PHP has a delay in his log.

Best regards,

clinty


----------



## DutchDaemon (Oct 19, 2009)

Are you in the GMT+2 timezone and is your system time set to GMT? (hmm, that would affect all of your logfiles -- see if php config is set to GMT maybe?)


----------



## clinty (Oct 19, 2009)

How configure that? I have no such informations in /etc/rc.conf.
A 'date' gave me:

```
Mon Oct 19 17:12:38 CEST 2009
```
I use OpenNTPD to be synchronized.


----------



## clinty (Oct 19, 2009)

If I try 'date -u', it prints '15:19:03', so I consider my system is in GMT+2.

Now, I don't understand the problem with php logs.


----------



## DutchDaemon (Oct 19, 2009)

Don't know if it's related: http://bugs.php.net/bug.php?id=45191
http://www.php.net/manual/en/function.date-default-timezone-set.php


----------



## clinty (Oct 20, 2009)

Thanks for the links. The bug you mentionned has been corrected (it seems!) and I use the last PHP version.
I tried to modify my php.ini, but no results.

A <?php echo date(); ?> will print the true date (gmt +2) and an error log will print the date (with 2 hours of delay).

It's not an important problem. Just strange.


----------

