My local installs of WordPress in XAMPP where excruciatingly slow, easily 5 seconds for each page load even with a clean install of WordPress. Local installs are supposed to make development in WordPress easier but 5 second page loads make it harder. I found solutions for this in several places and I’m linking one that has several of them in one answer on Stack Overflow.
What: I did two of these, and the reason I did these two, is that I found them elsewhere first. I put in my search query on the internet and open the first 3, 4, 5 promising options in tabs and then work my way through the tabs until my problem is solved.
The first thing I tried is to change the database host. This is what it said in my wp-config.php
define( 'DB_HOST', 'localhost' );
This is what I changed it to:
define( 'DB_HOST', '127.0.0.1' );
This actually helped! Page loading times went down from close to 5s to about 2s. I was very happy and still very unhappy. Even the cheapest shared hosting I’ve had to work with does better with a clean install of WordPress than that.
I left my wp-config.php with the changed DB_HOST since it worked and tried a second option. I looked for the CGI module in Apache to disable it.
In the XAMPP Control Panel click on the
config button for Apache and select
Apache (httpd.conf). This will open a file with configuration settings. Search for CGI until you find the line
LoadModule cgi_module modules/mod_cgi.so and then put a # in front of it, so it won’t be loaded. I also made a note at the end of the line (Naomi edit), just to remind me later. Save the file.
In the XAMPP Control Panel stop Apache and then start it again. Now WordPress load time was under a second and I was happy.
Of note: Most of the solutions I found were for MAMP but the two I tried worked beautifully on XAMPP even if the steps for the second solution are a bit different, it was easy enough to figure out.