You are running IIS/MSSQL/PHP with PHP in CGI mode and are get a “CGI Error” message from IIS.
A bug exists in the MSSQL driver that will cause this problem on high performance servers running PHP in CGI mode, especially if your app uses frames. It is related to lots of simultaneous connections to the SQL server from PHP.
A bugnote on the PHP database had lots of input, which can be read here: http://bugs.php.net/bug.php?id=9852
A solution was found, which involves tuning the Win2k or WinXP server for ‘Forground Applications’. This eliminates the problem completely.
It seems that CGI applications under IIS are launched into user space, owned by the IUSR_* user. So tuning the server to process forground apps makes sense. To do this, right-click ‘My Computer’, select ‘Properties’, select the ‘Performance’ tab, and then select ‘Forground Applications’ and click ‘OK’.