share connection descriptor between php files

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Lopo
Forum Newbie
Posts: 1
Joined: Mon Oct 07, 2002 1:21 pm

share connection descriptor between php files

Post by Lopo »

Hello

I'm trying to connect to an Oracle9i server using the oci8 dll under windows. It works fine using ociplogon. I use this function because it
is said that it makes a persistant connection to the database. My problem is that I want to share the connection descriptor in other php files and it seems that I have to reconnect every time!! Someone said to me that
I should call ociplogon on every page, but that this one will effectively
start a connection if there wasn't any other started by the same process.
I everytime I go to another page, ethereal sees that a new connection
is getting on!!
When do these objets <die>?
How can I share the descriptor between the php files?? I already tried
sessions, serialized, get, post but I get always the same error:
"The parameter you passed to ociplogon is not a valid oci8 objet"...

Thank you for any response:) sorry for my english :)
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

A persistent connection will speed up the attempt to establish a connection from a next page. However it is not possible to "pass" a connection resource between two php pages in any simple way.

Persistent connections don't die until the web-server process that created them dies. The persistent connection is only availible to the same web-server process that created it initially. On an average apache install you'll probably have between 10-32 child processes running, so you'll see new connections being made until all of these children have made a connection. After that the children will re-use the existing connection, until they have served something like 100 requests, when they die and get respawned, and which point they will create a new connection.
Post Reply