开发者

How to close an oracle db connection from php on an apache server? I mean close instantly

Usually closing a connection is simply done by oci_close($connection); or in a worse case when the php script ends the connection pass away.

In my case however, I face a different behavior.

If I access my application which uses PHP 5.2.8, Apache 2.2.11 and oci8 1.2.5, the connection is kept during several minutes.

Actually it seems to: if I 开发者_如何学Golaunch netstat -b I see that the process httpd.exe remains with the ESTABLISHED status on the database's URL during a while (a few minutes).

Could someone enlighten me on that behavior?

P.S. I do not use persistent connections.

P.P.S. As asked here is the code used to connect and close (this is a legacy application):

connection: a function is called whose connection related code is $connection = @ocilogon ( "$username", "$password", "$database" );

closing: responsability of every pages we develop but typically it'd be oci_close($connection)


From the docs on oci_connect() here (ocilogon() calls the same function):

http://www.php.net/manual/en/oci8.connection.php

It implies that you can close a connection explicitly via oci_close() or that it is closed automatically at the end of the page being rendered. I would imagine if you aren't closing explicitly that it might take it some time to timeout. Is it possible, that some of the pages that don't have oci_close() calls are causing the open connections you see?

If you create a standalone page with only an oci_connect() and an oci_close() and then execute it multiple times, do you see the connection count rise directly with how many times you executed the page and stay up before eventually coming back down?

Also, what indicator are you looking at to see that the connection is remaining open?

if you were on higher versions, then it might be Oracle 11g Database Resident Connection Pooling but that doesn't exist on your current versions you are using.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜