Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8396485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:32:55+00:00 2026-06-09T20:32:55+00:00

I have written a simple OCI wrapper class in PHP which uses persistent connections

  • 0

I have written a simple OCI wrapper class in PHP which uses persistent connections (oci_pconnect). The class destructor calls oci_close.

This class is used for all my AJAX PHP scripts and so is called a lot. However, despite using persistent connections and oci_close not removing these from the cache (as per my understanding), the number of open connections to the database is maxing out, causing the system to fail. I was expecting the number of open connections to be just one for the whole app!

Am I doing something obviously wrong?


Skeleton code:

class Oracle {
  private $connection;
  private $connected;

  function __construct($connectionString, $username, $password) {
    if (!($this->connection = @oci_pconnect($username, $password, $connectionString))) {
      echo 'Cannot connect to '.$username.'@'.$connectionString;
      $this->connected = false;
    } else {
      $this->connected = true;
    }
  }

  function __destruct() {
    if ($this->connected) {
      oci_close($this->connection);
    }
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:32:57+00:00Added an answer on June 9, 2026 at 8:32 pm

    Do NOT close the connection if you want it to be persistent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple database driven app in C# which uses a 2
I have written simple code to get content from xml file to php. $xml
I have written a simple web Application which is running(on Tomcat Server) fine on
I have written a simple CRUD form which has one select list. However the
I have written a simple jQuery.ajax function which loads a user control from the
I have written a simple Java class to generate the hash values of the
I have written a simple WPF application in which I wanted to test the
I have written a simple helloworld app with a WebView which has a link
I have written a simple WCF web service in C# which returns records from
I have written a simple PhotoEditor helper class to downscale and crop images uploaded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.