Edit report at https://bugs.php.net/bug.php?id=76804&edit=1
ID: 76804
Updated by: sixd@php.net
Reported by: dave dot reddy at enbridge dot com
Summary: oci_pconnect with OCI_CRED_EXT not working.
-Status: Open
+Status: Closed
Type: Bug
Package: OCI8 related
Operating System: AIX 7.1
PHP Version: 7.2.9
-Assigned To:
+Assigned To: sixd
Block user comment: N
Private report: N
New Comment:
The PR was merged to 7.2/7.3/master and will later be released on PECL as OCI8 2.1.9.
Previous Comments:
------------------------------------------------------------------------
[2018-09-04 17:40:00] php at koenigskind dot net
Related To: Bug #74420
------------------------------------------------------------------------
[2018-09-04 17:31:13] php at koenigskind dot net
Pull request: https://github.com/php/php-src/pull/3491
------------------------------------------------------------------------
[2018-08-27 20:18:46] dave dot reddy at enbridge dot com
OCI8 2.1.8 (as downloaded with php)
32 bit Oracle client.
32 bit build of PHP-FPM
------------------------------------------------------------------------
[2018-08-27 20:13:36] dave dot reddy at enbridge dot com
Description:
------------
oci_pconnect using clear text credentials works as expected.
oci_pconnect using OCI_CRED_EXT (Oracle Wallets) works only for the first PHP script run by a PHP
FastCGI (php-fpm) child process. The second script run by the child process will think it finds a
valid database connection, but the resource type is incorrect and nothing works.
In the first script run, the resource returned by oci_pconnect has a resource type of "oci8
persistent connection".
In subsequent scripts run by the same child fpm process, the resource type is "unknown",
the data type is shown as "resource (closed)".
Test script:
---------------
<?php
$sql = "select to_char(sysdate, 'dd-Mon-yyyy hh24:mi:ss') \"DATE\" from
dual";
echo "Connection Test 1\n";
// You'll need to setup an Oracle Wallet for the credentials
$conn = oci_pconnect("/", "", "DEV9_DASHBOARD", null, OCI_CRED_EXT);
print_r(gettype($conn));
echo "\n";
print_r(get_resource_type($conn));
echo "\n";
if ($conn === false) {
echo "Connection dead\n";
} else {
$stmt = oci_parse($conn, $sql);
if ($stmt === false) {
echo "oci_parse returns FALSE\n";
} else {
oci_execute($stmt);
$row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS);
var_dump($row);
sleep(1);
}
}
?>
Expected result:
----------------
Expected Results (this is the result the first time script is executed)
Connection Test 1
resource
oci8 persistent connection
array(1) {
["DATE"]=>
string(20) "27-Aug-2018 15:09:26"
}
Actual result:
--------------
When the fpm child process runs the same script a 2nd or subsequent time, the following results.
Connection Test 1
resource (closed)
Unknown
Warning: oci_parse(): supplied resource is not a valid oci8 connection resource in
/website205/PHPTEST/webapps/php/util/testoci.php on line 22
oci_parse returns FALSE
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76804&edit=1