• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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