Slow Page Load Times with IIS7.5 and PHP 5.3
So today has largely been spent prepping a shiny new VM for our Sugar CRM and Intranet site which I’m hoping to migrate over soon however I have spent most of this afternoon trying to figure out why page load times have suddenly shot up to over 2.5 seconds! This is only a fresh install of Sugar CRM that I have migrated so there is no data and yet *every* page is taking well over 2 seconds to load.
Even testing with a fresh install of PHP from a zip file off of their website (rather than using the Web Platform Installer), still results in long page loads, which is annoying as it means I can’t blame MS!
Downgrading to PHP 5.2 (thanks Web PI for allowing side by side installs of PHP!), instantly fixes the problems and my page loads go from 2.5s to under 1s, this is odd!
Even Google doesn’t seem to have many suggestions, but there are people who seem to have similar problems too, what gets odder is the few people who claim to have fixed it seem to imply that the issue is MySQL????
After an hour or so of comparing various forum posts claiming to have fixed it I have finally figured out the problem, in the 5.3 builds of PHP there is a bug that causes the slowdowns that is caused somewhere in the MySQL module during the mysql_connect phase.
To fix this it is as easy as changing your database connection from using a hostname (such as localhost or server.com), and instead using an IP address (such as 127.0.0.1 or 192.168.1.2). After a quick restart of IIS to make sure the changes get applied page loads are back down where I expect them to be.