phpdebianodbcsqlsrv

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF


I'm trying to use sqlsrv_connect to connect to an external SQLServer. In my php_info() page I see:

PDO -> PDO drivers -> mysql, odbc, sqlsrv
PDO_ODBC -> ODBC Connection Pooling -> Enabled, strict matching
pdo_sqlsrv -> pdo_sqlsrv support -> support ExtensionVer 5.11.1

This is my php code

$serverName = "tcp:123.123.123.123,1443";
$connectionInfo = array("Uid" => 'login', "PWD" => 'password', "LoginTimeout" => 10);
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn === false) var_dump(sqlsrv_errors());

The error returned is

This extension requires the Microsoft ODBC Driver for SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712

So I've tried to install ODBC using MS instruction from Install the Microsoft ODBC driver for SQL Server (Linux) page

When I do

apt-get update

apt return

Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://security.debian.org/debian-security bookworm-security InRelease
Hit:4 https://packages.sury.org/php bookworm InRelease
Get:5 https://packages.microsoft.com/debian/12/prod bookworm InRelease [3617 B]
Err:5 https://packages.microsoft.com/debian/12/prod bookworm InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
Reading package lists... Done
W: GPG error: https://packages.microsoft.com/debian/12/prod bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
E: The repository 'https://packages.microsoft.com/debian/12/prod bookworm InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

So I've tried

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF

but

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.5QMg7Qrr5w/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF
gpg: key EB3E94ADBE1229CF: "Microsoft (Release signing) <gpgsecurity@microsoft.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

When I do

apt-get update

apt return same error.

Any idea?


Solution

  • Solved by Microsoft at this page