Solved

PHP + Oracle persistent connections problem

Posted on 2007-12-06
3
900 Views
Last Modified: 2013-12-12
I have recently enabled persistent connection from our PHP application to Oracle by using oci_pconnect instead of oci_connect. 99% of the application works fine, but one specific script has problems. The problem is that I bind some variables by using oci_bind_by_name and I get an error that those variables are not binded. The script works 100% without persistent connections, and sometimes is works sometimes is does not work with persistent connections. Is there a sharing of bind variables when I use persistent connections, and multiple requests to the same script reset each-other's variables, or something similar to that? Otherwise I can't find out why it works sometimes and I can't predict the error.
0
Comment
Question by:bogdan_etechnics
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
poisa earned 500 total points
ID: 20503865
I'm not sure this is the case with Oracle but persistent connections with MySQL have been buggy (and risky) for a while in php. I tried to use them several times and never had god consistency.

Two things from the PHP manual that *might* be able to assist you (although it would seem that you have another problem, but there is no such thing as too much info, right?):

1) Warning:
There are a couple of additional caveats to keep in mind when using persistent connections. One is that when using table locking on a persistent connection, if the script for whatever reason cannot release the lock, then subsequent scripts using the same connection will block indefinitely and may require that you either restart the httpd server or the database server. Another is that when using transactions, a transaction block will also carry over to the next script which uses that connection if script execution ends before the transaction block does. In either case, you can use register_shutdown_function() to register a simple cleanup function to unlock your tables or roll back your transactions. Better yet, avoid the problem entirely by not using persistent connections in scripts which use table locks or transactions (you can still use them elsewhere).

2) (snip) Note, however, that this can have some drawbacks if you are using a database with connection limits that are exceeded by persistent child connections. If your database has a limit of 16 simultaneous connections, and in the course of a busy server session, 17 child threads attempt to connect, one will not be able to. If there are bugs in your scripts which do not allow the connections to shut down (such as infinite loops), the database with only 16 connections may be rapidly swamped. Check your database documentation for information on handling abandoned or idle connections.

I'll keep looking to see if I can find something a little bit more useful for your situation.
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 21188581
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
   Accept: poisa {http:#20503865}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

cyberwebservice
Experts Exchange Cleanup Volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21216923
Forced accept.

Computer101
EE Admin
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question