简体   繁体   English

PHP 5.6 Oracle 外部身份验证和 OCI_CRED_EXT 与 PDO 问题

[英]PHP 5.6 Oracle external authentication and OCI_CRED_EXT with PDO problem

I am wondering how it would be possible to use authentication using a secure external password store aka wallet with PDO OCI.我想知道如何使用带有 PDO OCI 的安全外部密码存储(又名钱包)进行身份验证。

See Oracle external authentication and OCI_CRED_EXT in the underground php oracle manual.请参阅地下 php oracle 手册中的 Oracle 外部认证和 OCI_CRED_EXT。 and

https://docs.oracle.com/en/database/oracle/oracle-database/19/dbseg/configuring-authentication.html#GUID-803496D2-19C7-4F02-94EC-C13EDD8FB17B (jump to chapter 3.2.9) https://docs.oracle.com/en/database/oracle/oracle-database/19/dbseg/configuring-authentication.html#GUID-803496D2-19C7-4F02-94EC-C13EDD8FB17B (jump to chapter 3.2.9)

Following works fine with oci8:以下适用于 oci8:

$conn = oci_connect('/', '', $db, 'UTF8',OCI_CRED_EXT);

note the OCI_CRED_EXT attribute!注意 OCI_CRED_EXT 属性!

But how can pass that option to a PDO OCI connection?但是如何将该选项传递给 PDO OCI 连接? Following might be close, but does not work:以下可能很接近,但不起作用:

$opt = [
      PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_NUM,
      'session_mode' => OCI_CRED_EXT,

];

  try{
      $conn = new PDO("oci:dbname=".$db.';charset=UTF8', "/","", $opt);
  }
  catch(PDOException $e){
      echo ($e->getMessage());
  }

Is it possible at all?有可能吗? Thank you very much!非常感谢!

It's not possible with PDO_OCI. PDO_OCI 是不可能的。 The implementation doesn't set OCI_CRED_EXT anywhere, unlike with OCI8.与 OCI8 不同,该实现不会在任何地方设置 OCI_CRED_EXT。 If you're using Oracle Cloud ADB, note that wallets are now optional.如果您使用的是 Oracle 云 ADB,请注意钱包现在是可选的。 If you use Instant Client 19.14 or 21.5 you can use 1-way ("walletless") TLS, similar to shown in https://towardsdev.com/connect-to-oracle-autonomous-database-from-python-without-using-the-instance-wallet-64bd16e4f31c如果您使用 Instant Client 19.14 或 21.5,您可以使用单向(“无钱包”)TLS,类似于https://towardsdev.com/connect-to-oracle-autonomous-database-from-python-without-using中所示-the-instance-wallet-64bd16e4f31c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM