When I am sitting on the computer where apache and php are installed (localhost) and I post a form to a php script there is a long delay before it returns the output from the php script.

This does not happen if I access the exact same files from a browser on any other computer other than the physical machine where the web server is.

I also found that there is no delay if I use the method "Get" instead of "Post" whether I'm on the localhost or not. Has anyone else noticed this strange behavior? Any ideas why it happens?

BTW, I'm on a windows 2000 machine with Apache 1.3.19, php 4.0.4pl1. I haven't had a chance to see if it happens on my linux box yet.

    5 months later

    I have the exact same problem. Last weekend (29-30 Sep 2001) I reinstalled an application I had previously built.

    Old/Build Environment:

    Host: WinNT workstation 4.0 SP6
    Web: Apache 1.3.19
    Lang: PHP 4.0.1
    DBMS: MySQL 2.23.35

    New Environment:

    Host: Windows 2000 Professional SP2
    Web: Apache 1.3.20
    Lang: PHP 4.0.6
    DBMS: MySQL 2.23.38

    The system monitor shows a huge CPU spike if the POST method sends the data. The CPU pegs at 100% and holds there for about 5 seconds.

    The problem occurs regardless of hostname, ie, "localhost" v. host name.

    Any clues would be appreciated.

      My setup : Win2k, Apache1.3.20, PHP4.0.6

      While serving a page from localhost and reading it from localhost I have experienced the exact same problem.

      When performing a post operation from a page viewed in Netscape, I find that if I maximise another application and then go back to Netscape, the post operation goes through speedily (use alt-tab shortcut).

      If I try the same thing with Internet Explorer, the post operation does goes to the next page (action ="..."), but the form data is not passed through.

      Looking for ideas.

      Rich
      Cape Town
      South Africa

        Rich

        My posts will go through and the information is passed regardless of using Netscape or IE. I had not visited this problem for a while, but when I just tested it again it seems that now IE processes the post immediately as it should and Netscape still takes forever. I have upgraded to IE 6.0 and Win2k service pack 2 since the last time I tried this.

        By the way I tried your trick of alt-tabbing to another application and right back to Netscape. That works for me to. The second I'm back on Netscape the connection to localhost has been made and it is either done or if it's a large query it is returning the results. If I don't alt tab it hangs for quite a while saying "connect: contacting localhost: waiting for reply"

        So it appears to be something related to Netscape.

        Still looking for answers. Let me know if you discover anything new.

          6 days later

          Question out of left field: I have the same problem, but it's with any kind of localhost operation - some operations process quickly, others take forever.

          I just installed a home network using Linux IP forwarding to masquerade IP, and part of that process involves setting an IP gateway, as well as passing DNS thru to the ISP via the gateway.

          Is it possible that the client application is trying to resolve localhost as a domain name before going to 127.0.0.1 as the second gateway option ?

            a month later

            I am not sure if this problem really has anything to do with name resolution. For some reason, submitting a post request to localhost causes the GUI (in general) to halt. I have the Win2K Task Manager up showing the CPU Usage graph. When I submit the form the graph locks up. Instead of switching to different windows I just ran my mouse across my main Explorer toolbar and that seemed to make the request go through.

            So the real question here is why is a network action somehow related to the GUI?

            shrug

            p.s. I'm not actually using PHP in this instance---Apache with Perl.

            • tenchi1174
              a month later

              Finally got a workaround.

              Form post by using javascript & open a small window, and immediately close it 🙂. It seems that Netscape's GUI really is the problem here (as already was pointed out by several other people).

              <snap>
              document.forms.transfer.submit(false);

              if (navigator.appName.lastIndexOf("Netsca",1)!=-1){w=window.open("dummy.html","dummywindow","innerWidth=30,innerHeight=30,outerWidth=30,outerHeight=30,screenX="+self.screenX+",screenY="+self.screenY+",alwaysLowered");w.close();w=null; }
              </snap>

              This is working .. try it!

              Hope this helps.

              Greetings

              Robert

                EXCEPT that I'm having this problem using Internet Explorer...

                Something someone else said elsewhere is that triggering a Windows interface event - in their case a taskbar event - cleared the blockage and the POST went through. I think the same is happening with your Netscape workaround - it's opening the new window that does the trick (for Windoze)... ?

                Some notes:
                - restarts solve the problem for a while;
                - form posts to MySQLd (in Win) cause about a 50% drain on system resources;
                - shutting down my ADSL connection resulted in the form posts going through immediately.

                There are multiple issues here - a GUI/GDI bottleneck somewhere, and (I'm almost certain) a DNS/gateway/route issue.

                Thoughts ?

                (PS. That workaround is an absolute disgrace laugh it might work but it's beneath me to implement 😉

                  I agree this solution is a complete laugh (from a programmers view), but i didn't had time to come up with something else 🙁 (at lease I found somthing that works)..

                  Nevertheless this problem is also on a localnetwork (no DSL or other internet connection), or just on the localhost(?) and strangly enough only with netscape, right from the start of the system (cold-boot), restart of the system doesn't help at all, just losing focus of the app (netscape in my case) is the only thing that helps.

                  Maybe it IS a GUI/GDI bottleneck, i'll try if it's a windows2000/XP problem only, and will let you know.

                  Even more strangely it's also there when you refresh the posting (my workaround doesn't work for this matter). I would be very interested to know if thats the case with your problem also ..

                  The research continues, I finally found a workaround (Quick-And-Dirty), after trying all other sorts of things, even running netscape with WinIce and putting breakpoints on the form posting routines (!) but i agree with you that it's not the way to go.

                  Greetz,

                  Robert

                    I've always had the sneaking suspicion that there's been a DNS issue, since watching with disbelief as requests to localhost first travelled up the DSL chain to my provider and back again.

                    Reading the MySQL Readme (gasp!) suggests that DNS resolution is in fact one of the (multiple) problems at work here:

                    (quote) If mysqld' is slow to answer to connections on Win95/Win98, there is
                    probably a problem with your DNS. In this case, start
                    mysqld' with
                    --skip-name-resolve' and use onlylocalhost' and IP numbers in the
                    MySQL grant tables. You can also avoid DNS when connecting to a
                    mysqld-nt' MySQL server running on NT by using the--pipe' argument
                    to specify use of named pipes. This works for most MySQL clients. (/quote)

                    This seems to have eliminated the strange wait times on my Win98 Apache+PHP+MySQL machine.

                    Incidentally I'm developing for Mamboserver and if anyone can tell my why the administrator password login is so monumentally fvkt, I'd be much obliged 🙂

                    Give this a try,

                    Daniel

                      6 months later

                      I have found that my page has no delay on IE yet on Netscape 4.78 it takes 100% of my CPU and can take at least 15 seconds to load.

                      You might find the threads here quite useful:

                      http://www.phpbuilder.com/forum/read.php3?num=1&id=127572&thread=127519

                      I am going to try upgrading my NS 4.78 to 4.79 for local development purposes and see if this makes a difference.

                      I also found this:

                      http://www.faqts.com/knowledge_base/view.phtml/aid/6967

                      It's a different issue but made me aware of the quality and quantity of HTML I am using for my NS 4.78 target users.

                      Ben

                        Something that I also found made a significant difference was setting the ServerName directive in Apache to:

                        ServerName 127.0.0.1

                        Hope this helps.

                        Ben

                          Write a Reply...