User's Manual

Disconnecting from the Database
3-6 Oracle Database Express Edition 2 Day Plus PHP Developer Guide Beta Draft
open simultaneously. The connection performance benefits need to be balanced with
the overhead on the database server.
Persistent connections are made with the OCI8 oci_pconnect() function. The
lifetime of persistent connections can be controlled by several settings in the PHP
initialization file. Some the settings include:
oci8.max_persistent - controls the number of persistent connections per process.
oci8.persistent_timeout - specifies the time (in seconds) that a process maintains an
idle persistent connection.
oci8.ping_interval - specifies the time (in seconds) that must pass before a persistent
connection is "pinged" to check its validity.
See the PHP reference manual http://www.php.net/manual/en/ref.oci8.php
for more information.
Disconnecting from the Database
The PHP engine will automatically close the database connection at the end of the
script unless a persistent connection was made. To explicitly close a database
connection you may call the oci_close() OCI function with the connection
identifier returned by the oci_connect() call. For example:
<?php
$conn = oci_connect('hr', 'hr', '//localhost/XE');
...
oci_close($conn);
...
?>