I have a Linux server (Ubuntu 10.04) running apache2 and PHP. Everything runs fine when accessing a page from any browser from another Linux machine or Mac. But when I try to access a page from any combination of Windows machine and browser I get about a 30 second delay before the page comes back. Accessing a plain old HTML file from the Windows browser runs lickity split. So it seems to be just PHP. MySQL is installed but a simple test page that uses no MySQL is still slow.
I don't think it is DNS because if I hard code the IP address in the URL nothing changes. There doesn't seem to be anything in the log files that I can tell.
What could be causing this behavior on Windows clients?
Best Answer
Update: some "3rd base" debugging tips;
A fairly brutal way to get some debugging is to strace the running apache process, and this is actually easier because the processes are going to be hung for a while.
This command below will only work as stated if your apache is in prefork mode, but I would assume that it would work vaguely similar in worker mode. (but you would have to spend some time getting a
ps
andgrep
to find the thread ids...) anyway I think php requires prefork...First check that the server is in prefork mode...
install strace
make some request to the server, and then run the following command to trace the syscalls made by the hung process;
let the page request run through on a windoze box that is slow and then paste all that output back into a pastebin and put the link in a comment.
If you don't have any joy with this, then turn on debugging of php, and httpd Loglevel to debug and paste all that into a pastebin and provide the link....
Edit: (ok maybe not definitely) possibly a reverse DNS problem on the apache server. try the following....
make sure you have set
HostnameLookups Off
on your apache server.http://httpd.apache.org/docs/2.2/mod/core.html#hostnamelookups
Also check that your resolv.conf is specifying working nameservers;
test nameserver with dig;
make the nameserver work, by changing it to 8.8.8.8 (google public dns server)
/etc/resolv.conf
Start by checking out the php.log and apache logs files for the connections which are slow, the problem is likely right there in logs.
However if you are sure that this is not a DNS problem (which you can check using the nslookup command line tool) and there is nothing obvious server side then I would then use google chrome in-built developer tools to see the timeline of the page load.
This will tell you which item in the page is taking so long, and whether the delay is during the connection, or during resource loading etc.
You can move on to tools like wget, curl in cygwin, or plain telnet to further investigate from the client side.