PHP on IIS 6 w/MS SQL HELP!!
Does anyone know why PHP might have intermittent connection problems to an MS SQL database?
PHP 4.3.9
WIN 2003 w/IIS 6
Sometimes the script will work fine but then for minutes at a time and for no aparent reason, the PHP script will yield:
Warning: mssql_pconnect(): Unable to connect to server: XBOX in C:\Siteroot\crm\data\main.php on line 7
The relevant code follows:
PHP Code:
define("db_hostname", "XBOX");
define("db_database", "CRM_DEV");
function query() {
$_conn = mssql_pconnect(db_hostname) or die(mssql_get_last_message());
mssql_select_db(db_database, $_conn) or die(mssql_get_last_message());
$_rset = mssql_query(@func_get_arg(0), $_conn) or die(mssql_get_last_message());
mssql_close($_conn) or die(mssql_get_last_message());
return $_rset;
}
Not even restarting MS SQL or IIS seems to fix the problem, it still errors out whenever it wants.