CoSign: Collaborative Single Sign-On  

cosign-discuss at
general discussion of cosign development and deployment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PHP with oracle interaction

  • To: kevin mcgowan <clunis@xxxxxxxxx>
  • Subject: Re: PHP with oracle interaction
  • From: LANE WILLIAM HOY <lanewhoy@xxxxxxxxx>
  • Date: Wed, 12 Jan 2005 10:29:36 -0500 (EST)
  • Cc: cosign-discuss@xxxxxxxxx, bbattey@xxxxxxxxx
  • In-reply-to: <>
  • References: <> <> <> <> <> <>

This did indeed turn out to be a php issue, and not a cosign issue. Bradford Battey's message of what to uncomment in the php*/ext/oci8/oci8.c was correct (I had stopped looking through the file at the definition of the oci_ping function, but missed the portion of the code where it is called). I uncommented it, recompiled php, and restarted apache, and the
problem went away. The patch is:

diff --unified=10 --recursive -u php-5.0.3/ext/oci8/oci8.c php-fixed/ext/oci8/oci8.c
--- php-5.0.3/ext/oci8/oci8.c   2004-11-22 16:46:49.000000000 -0500
+++ php-fixed/ext/oci8/oci8.c   2005-01-10 11:39:33.000000000 -0500
@@ -3040,25 +3040,23 @@
           connections or not!

           but only as pesistent requested connections will be kept between requests!

        /* TODO either keep servers global or don't reuse them at all */
        zend_ts_hash_find(persistent_servers, dbname, strlen(dbname)+1, (void **) &pserver);

        if (pserver) {
                /* XXX ini-flag */
-               /*
                if (!oci_ping(pserver)) {
                        pserver->is_open = 0;
-               */
                if (pserver->is_open) {
                        /* if our new users uses this connection persistent, we're keeping it! */
                        if (persistent) {
                                pserver->persistent = persistent;

                        return pserver;
                } else { /* server \"died\" in the meantime - try to reconnect! */
                        /* breakthru to open */

Lane Hoy
School of Dentistry Programming Services

On Sat, 8 Jan 2005, kevin mcgowan wrote:

be sure to let the list know if you achieve resolution. it's good to know this sort of thing. :)


On Jan 7, 2005, at 2:55 PM, LANE WILLIAM HOY wrote:


Currently I am pursuing a suggestion from Bradford Battey, who pointed out that I was looking at the wrong part of the oci8.c code in the php source, and uncommented the correct part of the code. I am rerunning the build process, and hopefully that works correctly.

Lane Hoy
School of Dentistry Programming Services

On Fri, 7 Jan 2005, kevin mcgowan wrote:

ah! graceful is hup. so the good news is that that at least won't make you look "down" to your users.

if Kasthuri Ilankamban (our Oracle DBA) and I can be of any help I'd be happy to lend a hand. Probably your best bet is to look into the error handling in your Oracle wrapper library and close the connection and reopen it if the connection is no longer valid. *Or* you could use something like this:

I have no experience with it, but we're going to look at it for a few of our services.


On Jan 7, 2005, at 10:50 AM, LANE WILLIAM HOY wrote:

I have not tried a 'kill -HUP $httpd_pid' yet, but issuing 'httpd -k graceful' works for sure. I just tried the latter method this morning on the stuck httpd test machine and that worked.
On the hot-backup issue, this is something that has been kicked around here for a while. There are a lot of issues involved in going to that for the production systems and historical reasons sort of things, so that sort of conversion does not match up with the timeline.
On Fri, 7 Jan 2005, kevin mcgowan wrote:
Have you considered doing a hot backup of Oracle? This is how we backup all of our production systems and it works well for us.
Do you actually have to stop and start apache or would a HUP accomplish re-upping the oracle connections?
I'm sure you get that the problem is that php is reusing the connection without checking to make sure it is still usable (after the server side has freed all of the resources associated with that connection. Is this an event that can just be handled in your php? which oracle library are you using? Pear::DB? Something else?
On Jan 7, 2005, at 8:28 AM, LANE WILLIAM HOY wrote:
We are trying to set up PHP to work with Oracle here at the School of Dentistry, but are running into a snag. The versions involved are:
PHP 5.0.3
Apache 2.0.52
Cosign 1.6.2
Redhat AES, current version,
Oracle 10g, custom install of just the client software and the precompilers. Also current version.
We are not using the Redhat-supplied version of apache as that did not work at all with cosign, but are compiling everything from source. We are using the Redhat-supplied MySQL, however.
This works fine on initial start of apache with the Oracle-backended application that we wish to deploy. The problem is this: we do cold backups of the Oracle database that sits in back of the web application. Once the database goes down and comes back up, the web application can no longer reconnect to the database without stopping and restarting apache as well. We are using the oci_new_connect function everywhere that we are trying to open the connection to the database, but that is not helping.
Has anyone else seen this problem, and does anyone have any suggestions? The one helpful thing that we found via google seems to have already been implemented in the version of php that we are using (uncommenting oci_ping in the oci8.c code so that the oci functions always check to make sure the database is up). Thanks in advance.
Lane Hoy
School of Dentistry Programming Services
... being a rock I am without movement ...

... "In, as you say, the mud." ...

... "In, as you say, the mud." ...


Copyright © 2002 - 2004 Regents of the University of Michigan :  Page last updated 15-December-2010