I'm having the same problems. I'm using PHP and MySQL with xquery, which is a PHP script to gather information from a halo gameserver. This all worked perfectly on windows 2000 advanced server, but now with windows 2003 enterprise it's all very slow.

It only occurs btw when a PHP script is accessing mysql, phpinfo.php is just as fast as it was.

    a month later

    I was tearing my hair out for weeks finding a solution to this problem. Finally figured it out. In php.ini, enable output buffering (output_buffering = on). That fixed it for me! 🙂

    Remember to restart IIS after the change in php.ini. This could be done by running iisreset from the command line on your server.

    Good luck!

    Ketil

      KetilMo, you are the man. This fixed my problem too. This has been plaguing me for a long time now.

      Cheers!

      Chris

        Chris -

        Glad to hear it worked for you too! 🙂 Have a happy new year!

        Regards,
        Ketil

          a year later

          Just wanted to say that this fixed the latency in my php code on a new win2k3 server. THANKS!!

          It was running previously on win2k and we moved the code over to the new platform. Ran horribly before enabling output buffering.

          Thanks again!!

          -JP

            Glad to hear that it worked for you too! 🙂

            Best regards,
            KetilMo

              output buffering is the best thing to do with IIS6.

              there is some problem with the way IIS6 uses the phpcgi calls weirdly. so IIS6 finds it better if it can parse the whole script before sending it out.

              microsoft strikes again

                6 months later

                Does anyone have a solution to Incredibly slow PHP/mySQL on Windows Server 2003 but running Apache not IIS? My php.ini has output_buffering = On, and the slowness still occurs. Each query from a php script takes about 30 seconds with NOTHING else going on.

                Much appreciated.

                Deltacode

                  KetilMo I think I love you ... not in the gay way though. Just the "dude, great find." kind of love.

                  Chad

                    18 days later

                    I have apache running on an os x box...dual processor G5.

                    I also have apache running on a single xeon 3Ghz machine on a DELL poweredge server.

                    The Mac can serve up pages faster...probably 25% faster.
                    Is this the general consensus for all you guys using these platforms out there?

                    😕
                    -J

                      For slow response with Mysql Across a network you can try adding this to the My.ini file.

                      skip-name-resolve

                        a year later
                        KetilMo wrote:

                        I was tearing my hair out for weeks finding a solution to this problem. Finally figured it out. In php.ini, enable output buffering (output_buffering = on). That fixed it for me! 🙂

                        Remember to restart IIS after the change in php.ini. This could be done by running iisreset from the command line on your server.

                        Good luck!

                        Ketil

                        Now this just blew my mind. I had a similar problem with MySQL being incredibly slow on Windows 2003 running IIS... on ASP/VBScript pages. PHP is also installed on the server and so is Microsoft SQL 2005 Express. (Yes, we're running ASP, PHP, MySQL and MS SQL on the same Windows 2003 Server using IIS.)

                        For the hell of it, I went into php.ini and changed output_buffering to on (at the above user's suggestion) and suddenly MySQL and ASP was faster... MySQL and PHP was faster... Microsoft SQL Server 2005 Express and ASP was faster.... everything was faster... even stuff that had no PHP!

                        And I didn't even have to restart IIS. As soon as I saved the php.ini file with the change, everything got faster.

                        Apparently PHP and MySQL and IIS are so intertwined somehow that changing the buffering setting really effects performance for the entire server.

                        Thanks for the solution. Even though this thread is old, I thought that this was valuable enough information to add. Hopefully it will help someone who is in the same position I was... with a slow server that shouldn't be slow and not knowing why.

                        So thanks and good luck.

                          4 years later

                          I know this thread is incredibly old but I do feel obliged to drag it up from the depths in order to put one last tidbit of information on here as the proposed solution to enable buffer output did not work for me as it did many others, and this is the first post that comes up on google for this issue.

                          My issue had to do more with my MySQL connection to a remote machine rather than PHP itself. I am working in a development environment, so my problem had to do with PHP connecting to the remote MySQL machine where the mysql setup was attempting to resolve the domain where there wasn't one. I was able to add "skip-name-resolve" to the bottom of the my.ini file and that resolved this issue for me - taking a page load from 4-5 seconds down to about 1/2 a second.

                            Write a Reply...