logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache 2.2.3 PHP 5.2 -> Apache 2.2.4 no SSL - Wrong Date
Author
NiGHtOwL



Joined: 11 Jan 2007
Posts: 14

PostPosted: Fri 12 Jan '07 0:23    Post subject: Apache 2.2.3 PHP 5.2 -> Apache 2.2.4 no SSL - Wrong Date Reply with quote

Hi there,
I am running a local testing area on Windows 2000 Pro, Servicepack 4

Currently Apache 2.2.3 Win32 no SSL / PHP 5.2 and all is working fine so far.

Yesterday I downloaded apache_2.2.4-win32-x86-no_ssl.msi.

I did uninstall the 2.2.3 version, and installed the newer version into the same directory as I always did before same way.

Apache 2.2.4 is running, no errors or warnings in the log file to read.

But:
I got a PHP Page reading remote host and date.

I do that with:
Code:

<? echo $_SERVER['REMOTE_HOST'];?>
<? echo date('d.m.Y H:i:s \h');?>


Apache 2.2.4 is showning then: 0.0.0.0 for any remote host and the time is two hrs backwards.

First I thought, I might have made a mistake with PHP 5.2, but as downgraded to 5.1.6 same errors showing. So I uninstalled apache 2.2.4 and went back to 2.2.3. Everything's fine.

I am not so much experienced that I would be able to find where this error might comes from. I tried to find this error via google and searching this forum without a result.

Has anyone got a clue?

If more information is needed I will try to do my best. Sorry for my poor english and I hope I made it understandable what's going on.

Thanks in advance and greetings

NiGHtOwL
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3094
Location: Hilversum, NL, EU

PostPosted: Fri 12 Jan '07 0:29    Post subject: Reply with quote

Looks like the same issue as described here: http://www.apachelounge.com/viewtopic.php?t=1237

tdonovan knows all about this issue.

It seems that it only happens with 2k, Workaround is to add in your conf Win32DisableAcceptEx


Steffen
Back to top
NiGHtOwL



Joined: 11 Jan 2007
Posts: 14

PostPosted: Fri 12 Jan '07 1:34    Post subject: Reply with quote

Thank you, I did so and remote host is displaying right now under Apache 2.2.4.

What still is "wrong" is the time. It is one hour back. I am in the GMT +1 Zone. With Apache 2.2.3 it is fine. Any clue to this?

...and thank you again. You are very helpful.

/Edit

I might add:

the serverlog shows the right time, for example:
***.***.***.*** - - [12/Jan/2007:01:05:00 +0100]

But PHP date is 1 hr back.

for a solution I added +3600, but that is no correct solution.

Code:

normal:
date('d.m.Y H:i:s \h')

momentary solution:
date('d.m.Y H:i:s \h', time() +3600)
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7374
Location: Germany, Next to Hamburg

PostPosted: Fri 12 Jan '07 10:39    Post subject: Reply with quote

For that issue see

http://www.php.net/manual/en/function.date-default-timezone-set.php

and

http://www.php.net/manual/timezones.php
Back to top
NiGHtOwL



Joined: 11 Jan 2007
Posts: 14

PostPosted: Fri 12 Jan '07 12:31    Post subject: Reply with quote

Thanks for your help.

I have to admit that I am totally new to this and I do not understand what they write in the manual. I am sorry, I do not know what to do. I read all this, but I do not understand.

I added (as far as I understood) to the PHP.ini

Code:

[Date]
; Defines the default timezone used by the date functions
date.timezone = "Europe/Berlin"


...still... wrong time, no effect. It should, because there can't be all webpages changed because of a new feature in PHP?

Thanks for your patience
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Fri 12 Jan '07 19:43    Post subject: Reply with quote

Hi NiGHtOwL,

I reported the problem with 0.0.0.0 on w2k to the Apache developer list. They decided to ship 2.2.4 with this bug rather than delay the release.
Since I was the only one to report it (and you are the only other person I know who has encountered it...), I guess that was appropriate.
It is already fixed for the next (Apache 2.2.5) release.
I guess there are few of us w2k users left. I'm happy to know there is at least one other w2k/Apache user!

Adding the Win32DisableAcceptEx directive works around the problem at a small cost in performance.
I measured the performance decrease as about -1% on average, and up to -5% for worst-case tests (very small static pages - about 1kb).

I cannot reproduce your time problem on my w2k/Apache 2.2.4 system.
I am in the -5hr (Eastern U.S.) timezone and both Apache 2.2.4 and PHP 5.2.0 show the correct time.

I didn't know that Apache could affect PHP's time calculations. You might try this as a test:
    In a DOS window, change to your PHP 5.2.0 directory and enter
    Quote:
    php.exe -r "echo date('d.m.Y H:i:s \h');"
This will show if PHP can display the correct time, independent of Apache. Apache does not even need to be running for this test.

-tom-
Back to top
NiGHtOwL



Joined: 11 Jan 2007
Posts: 14

PostPosted: Fri 12 Jan '07 20:03    Post subject: Reply with quote

Thanks for your answer tdonavan. I did as you further suggested and the time shows absolutly right in the command window. I did that two times. With Apache started or closed.

Question

Anyone got an idea?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7374
Location: Germany, Next to Hamburg

PostPosted: Sat 13 Jan '07 10:51    Post subject: Reply with quote

Did you set the correct path for your php.ini in httpd.conf? So that the changes you made take effect. PHPIniDir "C:/php5"

you can check that running a simple php script

Code:

<?php
phpinfo();
?>
Back to top
NiGHtOwL



Joined: 11 Jan 2007
Posts: 14

PostPosted: Sun 14 Jan '07 2:15    Post subject: Reply with quote

Yes, the path is correct an phpinfo.php works fine.

If you need to see it, tell me. I'll paste it then.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7374
Location: Germany, Next to Hamburg

PostPosted: Sun 14 Jan '07 15:14    Post subject: Reply with quote

Hm, from that output I only wanted to see if PHP takes the correct path from httpd.conf

Configuration File (php.ini) Path C:\server2\php\php.ini

But that idea seems to failed. I realy tried hard to reproduce that error. But I don't got that. Confused
Back to top
NiGHtOwL



Joined: 11 Jan 2007
Posts: 14

PostPosted: Sun 20 May '07 7:01    Post subject: Reply with quote

The problem is finally solved.

I found out that it only exists on the index.php. On all error pages which I did the time is fine.

I am not an expert in PHP, but then I came to the conclusion that there is something wrong with my index.php. The code was just fine, but I required a browsercap php and in there a time (UTC) overwrote the server time. I took out this line and now it works.

Murphy's Law............ at least for me Wink

Thanks to all who tried to help and at least I wanted to leave a note that it is solved now.
Back to top


Reply to topic   Topic: Apache 2.2.3 PHP 5.2 -> Apache 2.2.4 no SSL - Wrong Date View previous topic :: View next topic
Post new topic   Forum Index -> Apache