|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61502 pdo_oci persistent connections broken with Oracle 9.2 servers
Submitted: 2012-03-24 22:55 UTC Modified: 2014-01-01 12:39 UTC
From: andre at tomt dot net Assigned:
Status: Open Package: PDO OCI
PHP Version: 5.4.0 OS: Ubuntu 12.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-03-24 22:55 UTC] andre at tomt dot net
I've only verified this in PHP 5.3.10, but I checked that the relevant code has not changed in git/master.

Enabling persistent connection to Oracle 9.2 servers does not work. The server seem to brutally kill the connection on OCIPing, a function the code in ext/pdo/oci_driver.c:pdo_oci_check_liveness() assumes will fail gracefully on older Oracle versions.

This makes the error_code == 1010 check fail and it will (now correctly) re-connect to the server, saving the day by not failing in a user-visible way, but however rendering persistent connections to 9.2 servers useless and adding ~900ms of extra latency (in our case).

I tried extending the check to the resulting 3113 (end-of-file on communication channel) error, but it turned out the connection really is dead at that point.

Is there really any downside to just using OCIServerVersion instead of OCIPing?

Test script:
$pdo = new PDO(


Expected result:
connections not beeing re-established (source port numbers in netstat -anp not changing)

Actual result:
connections beeing re-established (source port numbers in netstat -anp changing), incurring a large latency penalty.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-26 17:47 UTC]
Check you have the latest Oracle DB patchset and latest Oracle
11.2 client.  Look for Oracle traces.  Utilize Oracle Support to
identify the cause and find a remedy.  I've not seen other reports of
problems.  Does the OCI8 extension have the same problem?

OCIServerVersion and OCIPing check different things.  The latter can
check more to provide better reliability.  If your same PHP code
connects to multiple Oracle DB versions, perhaps you could modify the
PDO_OCI source and add a runtime check to determine which function to

Oracle 9.2 was released in 2002. Oracle's Extended Support for it
finished in 2010.  (Ref:

The PDO_OCI extension currently does not have a maintainer.  The
OCI8 extension does, and has better functionality.  Using OCI8
is preferred.
 [2014-01-01 12:39 UTC]
-Package: PDO related +Package: PDO OCI
 [2016-04-21 10:07 UTC] 34557049 at qq dot com
WINDOW 64BIT APACHE2.4 PHP Version 5.5.12 

class LocalSoapClient extends \SoapClient
    public $server = '';

    function __construct($wsdl, $options) {
        parent::__construct($wsdl, $options);
        $this->server = new \SoapServer($wsdl, $options);
        // $this->server->addFunction('Add');

    function __doRequest($request, $location, $action, $version, $one_way = 0) {
        $response = ob_get_contents();
        return $response;

ErrorException in LocalSoapClient.php line 22: SoapServer::setClass(): Tried to set a non existent class (App\Libaraies\HelloWorld)

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Feb 27 10:01:24 2021 UTC