I have a server running Windows Server 2008 SP2 (actually a virtual server running under Hyper-V) with MySQL 5.1.52. On a separate virtual server also running Win Server 2008, I have IIS installed along with PHP 5.3.3. PHP scripts run great. Websites used to be able to use PHP to pull from the MySQL server reliably. However, now I am getting very intermittent problems. When I try to open a page that pulls from MySQL, about 50% of the time it is successful. The other 50% the script times out and I get a 500 internal server error. If I turn on detailed errors, this is the type of error I'm getting:
PHP Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://x.x.x.x:3306) in D:\path\index.php on line 4 PHP Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in D:\path\index.php on line 4 PHP Fatal error: Maximum execution time of 15 seconds exceeded in D:\path\index.php on line 4
I've looked at IIS logs, MySQL logs, etc and cannot track down why it works half the loads and times out the other half. Any ideas or tips to help troubleshoot?