473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Help: Hundreds of connections PHP->Oracle

Hi,

we got a strange problem connecting to an Oracle database onsite with
our PHP application: During CSV import job handled by our application,
PHP opens up to some hundred connections to the database. It then
eventually fails to connect to the database due to the high number of
open connections.

We are not able to reproduce this behaviour on our internal
installations, we get up to 30 connections until the job is finished.

The environment:
SuSe/Novell SLES9
Oracle 10.2.0
PHP 4.3.11
OCI8 1.274 (PEAR OCI8 1.1.1 beta)
Zend Optimizer 2.6.0

Does it make any difference if oracle is installed locally or on another
machine? Is it relevant if we connect to the database using a
service_name or a SID?

Any comments, hints, help?

Best regards from Aachen, Germany
Keith Sauvant
Feb 15 '06 #1
9 2012
I've seen something about this in the past but can't remember exactly
why it happened (Oracle not closing connections).

It was something to do with Auto Commit - the behaviour changed when
you switched it on or off... I don't have any code examples to hand
though.

Feb 15 '06 #2
On Wed, 15 Feb 2006 15:31:27 +0100, Keith E. Sauvant wrote:
Does it make any difference if oracle is installed locally or on another
machine? Is it relevant if we connect to the database using a
service_name or a SID?

Any comments, hints, help?


You are probably using persistent connections?

--
http://www.mgogala.com

Feb 16 '06 #3
On Wed, 15 Feb 2006 07:44:19 -0800, jonathan.beckett wrote:
I've seen something about this in the past but can't remember exactly
why it happened (Oracle not closing connections).


It's persistent connections problem. I believe that this was resolved in
5.1.2, not before. The problem is that whenever one uses oci_pconnect,
httpd process opens session. For some reason, when a new HTTP request
is issued, new httpd process is created and logged into the database.
When the number of httpd threads is high enough, "sessions" parameter
is exhausted and nobody can connect any more. There are nuances, I believe
that the problem only manifests itself with shared servers or something
like that. If you need it for the commercial use, I wholeheartedly
recommend Zend Core for Oracle. It's beautiful and most of the OCI bugs
are fixed.

--
http://www.mgogala.com

Feb 16 '06 #4
Mladen Gogala schrieb:
On Wed, 15 Feb 2006 15:31:27 +0100, Keith E. Sauvant wrote:
Does it make any difference if oracle is installed locally or on
another machine? Is it relevant if we connect to the database using
a service_name or a SID?

Any comments, hints, help?
You are probably using persistent connections?


Yes, we do. Means: we were ;-) I tried without persistent connections
yesterday and it had far more comprehensible behaviour. Still waiting
for the customer test results.
It's persistent connections problem. I believe that this was resolved
in 5.1.2, not before. The problem is that whenever one uses
oci_pconnect, httpd process opens session. For some reason, when a
new HTTP request is issued, new httpd process is created and logged
into the database.
But: In our case it is ONE PROCESS that starts opening connections. We
start a script that runs for some hours. It runs fine for one hour and
then it starts opening additional connections to the database. Strange
behaviour.
If you need it for the commercial use, I wholeheartedly recommend
Zend Core for Oracle. It's beautiful and most of the OCI bugs are
fixed.


I like the idea of using Zend Core for Oracle. But: PHP5 is still not
certified for some of our customers.

We use the latest PECL OCI8-Extension. That should be exactly the one
Zend Core uses. Am I right?

Best regards
Keith
Feb 16 '06 #5
On Thu, 16 Feb 2006 09:39:11 +0100, Keith E. Sauvant wrote:
We use the latest PECL OCI8-Extension. That should be exactly the one
Zend Core uses. Am I right?


I'm not sure about that. I believe it is a separate branch.

--
http://www.mgogala.com

Feb 16 '06 #6
On Thu, 16 Feb 2006 11:44:03 GMT, Mladen Gogala <go****@sbcglobal.net> wrote:
On Thu, 16 Feb 2006 09:39:11 +0100, Keith E. Sauvant wrote:
We use the latest PECL OCI8-Extension. That should be exactly the one
Zend Core uses. Am I right?


I'm not sure about that. I believe it is a separate branch.


The OCI8 extension bundled with Zend Core, the one from PECL and the one in
PHP 5.1.2 are all the same branch.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Feb 16 '06 #7
I would use twisted and cherrypy instead. You wont need nearly as many
connections to oracle.

Feb 17 '06 #8
On Fri, 17 Feb 2006 15:34:29 -0800, boozkachu wrote:
I would use twisted and cherrypy instead.


I fail to see how could bakery products help him. On the other
hand, blessed are the cheesemakers, so why not try with cherry
pies? Always look on the bright side of life. For life is quite absurd,
and death's the final word, you must always face the curtain with a bow.
Forget about your sin, give the audience a grin, enjoy it's the last
chance of the hour, so always look on the bright side ....

--
http://www.mgogala.com

Feb 18 '06 #9
"Keith E. Sauvant" <ne********@spamgourmet.com> writes:
I like the idea of using Zend Core for Oracle. But: PHP5 is still not
certified for some of our customers.
Coming late to the party but FWIW, the re-factored OCI8 driver (aka
OCI8 1.1 onwards) was designed to be usable with PHP 4.
We use the latest PECL OCI8-Extension. That should be exactly the one
Zend Core uses. Am I right?


ZCO picks up the latest PECL build. The release schedules are not
completely syncronized but there was a new PECL OCI8 1.2 bundle on 16
March at http://pecl.php.net/package/oci8 that matches ZCO 1.3.1. (It
will take a short while for the pre-built Windows stack on
http://pecl4win.php.net/ext.php/php_oci8.dll to complete builds of
1.2.)

Another advantage of the re-factored OCI8 driver (aka OCI8 1.1
onwards) is that the the oci_close/ocilogoff function is no-longer a
no-op. You can now force a connection to close. This may be useful
in scripts that only access Oracle for a short time relative to other
PHP processing because resources can be freed for other Oracle users.

Chris
Mar 16 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Philip D Heady | last post by:
PHP Warning: ocilogon(): _oci_open_server: Error while trying to retrieve text for error ORA-12154 Anyone get this error before?
11
by: Philip D Heady | last post by:
Ok I'm a newbie to using Oracle9i w/ PHP, been a MySQL guy... What is the proper sql statement to use insert tables, etc. as below.? I don't know much about how OciParse works. I can connect...
9
by: Philip D Heady | last post by:
Ok, as some of you may know I'm an Oracle newbie w/ PHP. I'd rather use MySQL but at the office here we use Oracle and boy do I have alot to learn. I'm starting to hate it after using MySQL!! ...
0
by: PedroSilva | last post by:
I need to know how to get a collection (varray), basically it's an array of chars with size of 9999 positions, from oracle so I can use it as an array with php. There's very little documentation...
0
by: 2291980 | last post by:
Hello I am trying to use oracle with php i have configured the php & oracle on my window-xp system . i have all the necussary changes that need be done. i have uncomment the code , in php.ini...
0
by: *Davide* | last post by:
Hello, This query (PHP+Oracle) works: global $user,$pass,$sid; $db_charset = 'UTF8'; $db = OCILogon($user, $pass, $sid, $db_charset); $clob = OCINewDescriptor($db, OCI_D_LOB); $txt_clob =...
1
by: raviva | last post by:
Hi, my name is Ravi. I got a new task of connecting to an SQLServer remotely from our Oracle Server. We have our database on Unix server. Please assist me regarding this connection. Thanks, Ravi.
1
by: www.douglassdavis.com | last post by:
I have an Apache server, PHP 5.2.5 and Oracle 10g Express Edition for development purposes on my laptop running Windows XP. I am using OCI to connect to Oracle from PHP I am using MDB2...
6
by: Anthony Smith | last post by:
How can I make these inserts faster? $insert = "INSERT into AFF_KIAC_ACCT_ALIGNMENT " . "(KIAC_ACCT_NBR, REGION_CD, ORIGIN_LOC_CD,TERRITORY, FISCAL_HALF, FISCAL_YEAR, MAINT_USER_ID)" . "...
1
dlite922
by: dlite922 | last post by:
Hey guys. I don't think i've been into this forum for a while. I'm trying to install the oracle (ori8 ?) extension on php on a suse linux (v11?). Most of the (google results) articles just say...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.