PHP 5, PHP 7, PHP 8, PECL OCI8 >= 1.1.0
oci_close - Closes an Oracle connection
Code Examples

oci_close( resource$connection ): bool|null

Unsets connection. The underlying database connection is closed if no other resources are using it and if it was created with oci_connect or oci_new_connect.

It is recommended to close connections that are no longer needed because this makes database resources available for other users.



An Oracle connection identifier returned by oci_connect, oci_pconnect, or oci_new_connect.

Return Values

Returns null when oci8.old_oci_close_semantics is enabled, or true otherwise.



Variables that have a dependency on the connection identifier, such as statement identifiers returned by oci_parse, must also be freed before the underlying database connection is closed.


Prior to version PHP 5.1.2 (PECL OCI8 1.1) oci_close was a no-op. In more recent versions it correctly closes the Oracle connection. Use oci8.old_oci_close_semantics option to restore old behavior of this function.


The oci_close function does not close the underlying database connections created with oci_pconnect.

Related Functions

Example of oci_close

Show all examples for oci_close

PHP Version:

Function oci_close:

Oracle OCI8 Functions

Most used PHP functions