Ramblings of Daniel Graziotin

Apache, PHP, MySQL slow under Windows 8. How to fix.

A

I recently escaped from Apple based computers to go back to normal laptops. I purchased a very powerful Lenovo ThinkPad W530. It is a war machine. I am so happy and satisfied with it that I will even keep Windows 8 Professional for a while. I will then switch back to my beloved GNU/Linux as well.
Meanwhile, I still have to accomplish many development task, some of which are classic web development (read: PHP, MySQL, and Apache).

There are so many WAMP solutions for Windows 7 (e.g., WampServer, Bitnami stacks, and EasyPHP). While many of them will work on Windows 8 without issues, XAMPP is Windows 8-ready.

Unfortunately, I encountered a widely reported issue. Apache PHP, MySQL are slow under Windows.. Terribly slow. Sometimes, even slower than deployed websites on the Internet. I had to wait from 3 to 10 seconds just to load a local WordPress website.

In this short post, I summarize all the proposed fixes and report which one really solved my problem.
The following are only a small part of the proposed fixes to solve WAMP slowness under Windows 7 and Windows 8:

  1. Exclude Apache, PHP, and MySQL from your Firewall checks.
  2. Add Apache, PHP, and MySQL executables, and the Website Folders as exceptions of your Antivirus.
  3. Make sure you are loading PHP as an Apache module rather than using CGI methods.
  4. Tune php.ini.
  5. Disable xdebug extension.
  6. Disable IPv6.
  7. Make sure that Apache only listen to IPv4 as well.
  8. Setup a proper hosts file: disable IPv6 localhost, enable the IPv4 localhost counterpart, and make sure to do the same for all your VirtualHosts, if any.
  9. Employ Voodoo-like tunnelling systems.

I did all of them without any reasonable improvement. Sure, they might all help after applying the only fix which worked for me.

Do you want to know what really fixed the issue for me? Promise you will not laugh.

I mostly worked on GNU/Linux in the last 10 years. Somehow, I employed OS X as well. Unfortunately, I am not a Windows power user. I don’t seriously use Windows since XP.

Today, I discovered that there is a serious difference between the “Balanced” and the “High Performance” power plans of Windows.
This difference is still strong when not using the battery (that is, power cable plugged). While GNU/Linux and OS X somehow unleash the beasts living in our laptops when the power cable is plugged, Windows on my Lenovo did not. It still was limiting CPU scaling capabilities and keeping it as much low as possible.

Either switching to “High Performance” power plan or customizing the “Balanced” plan settings solved the issue for me. In particular, I think that bringing the “Minimum Processor State” option from 5% to 80% does the trick. You can bring it to 100% if it doesn’t make your laptop lift-off.
Additionally, I (finally!) stopped complaining how Windows 8 was still slow when opening Google Chrome, IntelliJ Idea, or the File Explorer itself despite using a SSD drive. Comparing to GNU/Linux, the difference was huge. Now it is no more.

I feel a little dumb. However, we never stop learning and I am happy to share this experience.

About the author

dgraziotin

Dr. Daniel Graziotin received his PhD in computer science, software engineering at the Free University of Bozen-Bolzano, Italy. His research interests include human aspects in empirical software engineering with psychological measurements, Web engineering, and open science. He researches, publishes, and reviews for venues in software engineering, human-computer interaction, and psychology. Daniel is the founder of the psychoempirical software engineering discipline and guidelines. He is associate editor at the Journal of Open Research Software, academic editor at the Research Ideas and Outcomes (RIO) journal, and academic editor at the Open Communications in Computer Science journal. He is the local coordinator of the Italian Open science local group for the Open Knowledge Foundation. He is a member of ACM, SIGSOFT, and IEEE.

28 comments

  • I have a powerful ASUS gaming machine running Windows 8 that I use for development, and running a WAMP set up was really slow. I tried step 6, disabling IPv6. Works brilliantly.

    Thank you so much for sharing your experience. It has fixed my problems.

    Brent

  • Thank you SO very much. My development team has been struggling with this issue for months and you saved my sanity. I would have never guess that a Windows 8 Desktop would default to 5% min. processing power. I can’t thank you enough!

    • a professional developer team knows, that best platform or os for developement is linux, mac or something unix*

      • I am sorry I have to disagree here. I am an open source user, developer, and often advocate. However, my philosophy is that one should use whatever makes (s)he happy and satisfied, including proprietary OS and software.

        There are very good tools and environment for developing under Windows. Additionally, virtual machines and tools like Vagrant and Docker are making life really easy nowadays.

        I use Windows very, very rarely (I am typing this on a Macbook, which my university assigned to me) and it surely is my very least favorite OS. But it does not really matter what OS you use, as long as you are happy with it.

  • Thanks for sharing, my computer chugs with xammp and wamp installed. Looking forward to applying these fixes.

  • I didnt try all those other solutions. Just the one that worked for you, and it worked for me too. i would never have guessed that windows 8 limits processing A LOT when in power saver mode. it didnt happen like that in win7, xp, vista etc

    thanks a lot!!

  • I’m having the same issue. I can’t wait to try your suggestions… specially, disabling IPV6 and CPU power consumption.

    If its the CPU power consumption, I make the question: why the hell MS limits the power of my laptop by default??? The laptop it’s mine not theirs – if I want to destroy it, its only my fault not theirs. This smells like Apple… :p

  • After everything I tried with this and I mean everything and it was the power management all a long I was going to drop back down to a 32bit build, you just saved me about 20 Mins reisntalling all that but save me about a hours in downloading as mobile internet hates me right now 🙂

    Nice read

  • for me work to remove xdebug.
    all the other voodoo make nothing.

    But no xDebug not meet demands.
    But anyhow nice collection of to try

  • Thank A LOT! I increased my minimum processor state as you suggested and it’s really much faster. Thank you for this!

  • If you do not want to disable IPv6, the solution that worked for me was changing the connection from localhost to 127.0.0.1. For example, using PDO to connect:

    new PDO(‘mysql:host=127.0.0.1; etc….’);

  • Very good explanation , but still i have a problem ! ! ! ! … The problem is … i had Xammp on my system and without uninstalling it , i installed WAMP … So i check wamp the i uninstalled Xammp and tried to use wamp , but not working and it was always on orange colour icon on system tray … i did all these things that you said and still , not working ! don’t know what is the problem … can you tell me what should i do !?! 

    • It looks to me that, having both Xammp and WAMP installed, there are still some Xammp parts running and employing some of WAMP’s ports. This is just a guess, however. Have you rebooted your system between each install/uninstall?

  • From 6 seconds to 1 second – thanks a lot! (windows 10)

    What worked:
    – NB high performance power plan
    – disabling ipv6
    – disabling xdebug
    – disabling other modules in php.ini I don’t use (sqlite etc..)

  • I found this post very helpful however ultimately none of the solutions here that I tried worked for me, I thought I would add one to the list that finally worked for me.

    I have my webroot directory under dropbox, this does not normally cause any problems, however there was one particular assets directory which had constant file changes, excluding this assets directory from dropbox sync significantly improved/fixed my localhost serving.

    Hope this may save someone else some pain.

By dgraziotin
Ramblings of Daniel Graziotin

About Author

dgraziotin

Dr. Daniel Graziotin received his PhD in computer science, software engineering at the Free University of Bozen-Bolzano, Italy. His research interests include human aspects in empirical software engineering with psychological measurements, Web engineering, and open science. He researches, publishes, and reviews for venues in software engineering, human-computer interaction, and psychology. Daniel is the founder of the psychoempirical software engineering discipline and guidelines. He is associate editor at the Journal of Open Research Software, academic editor at the Research Ideas and Outcomes (RIO) journal, and academic editor at the Open Communications in Computer Science journal. He is the local coordinator of the Italian Open science local group for the Open Knowledge Foundation. He is a member of ACM, SIGSOFT, and IEEE.

News