• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue PHP cannot connect to MSSQL after update #53

Cruachan

New Pleskian
I have two servers which can no longer connect to MSSQL after this upgrade. PHP versions 7.1.x, 7.2.x and 7.3.x are all affected. 7.0.x and earlier can still connect fine.

Simple connection script

$serverName = "myserver";
$uid = "myuid";
$pwd = "mypassw";
$databaseName = "mydb";

$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>$databaseName);

$conn = sqlsrv_connect($servername, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r(sqlsrv_errors(), true));
}

Results is

Connection could not be established.
Array ( [0] => Array ( [0] => IM004 [SQLSTATE] => IM004 [1] => 0
Code:
 => 0 [2] => [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed [message] => [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed ) )

I have fallen back to PHP 7.0 in the meantime, where the above script work fine.  It was working fine until Plesk patch #53 was applied yesterday.
 
Can you please specify which OS exactly you have? and which version of MSSQL you are connecting to?
Indeed there were changes in sqlsrv extension in scope of this update.
 
I'm also facing same issue. I have Windows Server 2012 R2 and trying to connect to MSSQL Server 2012.
 
Back
Top