|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29779 ORA-24327
Submitted: 2004-08-21 11:30 UTC Modified: 2005-09-08 11:50 UTC
Avg. Score:4.7 ± 0.7
Reproduced:102 of 103 (99.0%)
Same Version:51 (50.0%)
Same OS:31 (30.4%)
From: robertg2 at hope dot ac dot uk Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 5.0.1 OS: Solaris 8
Private report: No CVE-ID: None
 [2004-08-21 11:30 UTC] robertg2 at hope dot ac dot uk
We've recently upgraded to PHP 5.0.0 (and subsequently PHP 5.0.1) and have begun to experience a major issue with the OCI8 connection functions.  The database that the web form integrates with goes offline for a while every night and immediately afterwards users receive the following error message - that is, until apache has restarted:

Warning: ocinlogon() [function.ocinlogon]: OCISessionBegin: ORA-24327: need explicit attach before authenticating a user

I've tried using oci_new_connect, ociconnect and ocinconnect.  I've tried specifying the whole of the relevant section of tnsnames.ora as an argument to ocinlogon() as suggested somewhere else - although this DOES work, it does not solve the problem.

We are running Oracle 9.2 client and database with PHP on Solaris 8 64bit and this is a LIVE SITE!! :(

Reproduce code:
I suggest:

- Connect to an oracle database using PHP oci8 functions from within Apache
- Knock that database offline
- Attempt to connect again using PHP oci8 functions within same instance of apache
- Put the database back online
- Again, attempt to connect to Oracle database from within apache using OCI8 functions

Expected result:
The following Oracle error should occur on a successful reproduction of the problem:

ORA-24327: need explicit attach before authenticating a user


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-21 20:30 UTC]
It's a known feature and will be probably fixed in future versions. 
Currently you can fix it yourself with uncommenting ociping() function in oci8.c and recompiling PHP. 
Or, much easier way, do not shutdown the database or restart Apache in the same time - all established connections will be discarded and ocilogon/oci_connect will establish new ones.
 [2004-08-21 21:23 UTC] robertg2 at hope dot ac dot uk
Thanks Tony.  Can I just clarify something - are you saying that oci_new_connect() and ocinlogon() don't actually establish new connections?  I was under the impression that these functions forced a new connection to be made.
 [2004-08-21 21:59 UTC]
Yes, these functions establish new connection. But this error can be also concerned with internal Oracle Interface Library problems (search this error message in google) and not with PHP. 
Nevertheless, PHP doesn't ping already established connections, because it would slow down things too much. Probably in the future we will add an ini setting for it, but currently ociping() is just disabled for perfomance reasons.
 [2004-11-22 14:44 UTC] stasamj at kscems dot ksc dot nasa dot gov
Getting a very similar problem with database on Solaris 8 64-bit Oracle using Oracle listener, PHP server 4.3.7 on RedHat Linux (2.4)/Apache 1.3.  Following weekly cold backup, PHP keeps trying to use cached persistent connections, giving ORA-24327 and/or ORA-03113 (end-of-file on communication channel).  Can trap the error, but can't figure out how to flush the dead connections from the connection cache!  Hate to cron an Apache restart daily...
 [2004-11-22 15:00 UTC] robertg2 at hope dot ac dot uk
I ended up using the oracle extension rather than the oci8 extension.  Have had no problems since.
 [2005-02-01 11:48 UTC] rickyblankenaufulland at leonardo dot de
Expiring the same problem on Linux (Fedora 2, Kernel 2.6.5). Restarting Apache with option graceful is okay in an internal environment but fixing this error would be very nice too ;-)
 [2005-02-03 10:49 UTC] olaf dot imig at bifab dot de
Getting a very similar problem after PHP-Upgrading with following system:
Solaris 8 32 bit Oracle and Apache 2.0.52 PHP 5.0.3

After shutdown and startup database first I got ORA-03113 (end-of-file on communication channel) and then ORA-24327 (need explicit attach before authenticating a user). With the same system and PHP 4.3.10 I have no problems, because of that I think, it is too simple to say and not helpful, thats an Oracle-Problem.
 [2005-03-07 18:12 UTC] rcarvalho at queirozgalvao dot com
I have the same error with PHP under Windows 2003/IIS accessing Oracle 8.1.7 with 8.1.7 client.
I have tried every thing that was sugested in this paper, but the error remains.
 [2005-04-05 15:34 UTC] cameron at woods-clan dot com
I am experiencing the same issue using IPL 6.1, php 5.0.3 and Oracle 64-bit, we are running on Solaris 8.  I need to find a better solution than restarting the server or as it has been indicated uncommenting ociping() from the oci8.c and recompiling since there are indications that this will degrade performance.
 [2005-05-03 00:39 UTC] mark_vandersteen at national dot com dot au
We are getting this bug regularly as well. We are using the Oracle-Instant-Client / php 5.0.3 / apache2 on a linux fedora 3 box.
 [2005-05-06 20:35 UTC] chris dot chen at sun dot com
well, I just wanted to note that. I encountered this
problem intermittently with:

   oracle's instantclient-
   Oracle9i Enterprise Edition Release

from both:

   oci_connect/oci_new_connect($1, $2, $3).
 [2005-05-24 14:28 UTC] rootradical at hotbox dot ru
I have the same "feature" (oci_connect(): OCISessionBegin: ORA-24327: need explicit attach before authenticating a user) using PHP 5.0.4 on Win2k SP4, Apache 2.0.47, Oracle9i Enterprise Edition Release - 64bit Production.
Unfortunately, I can't recompile oci8.c with ociping() enabled and it's very inconveniently to restart Apache every time database goes down. I hope you release some fix in the not too distant future. Because of this I need to use PHP 4.3...
 [2005-06-13 19:58 UTC] wustl_2008 at yahoo dot com
I am experiencing the same problem on Apache 5.0.0 with Oracle 9.2.  Any solutions besides rebooting the Apache server are greatly appreciated as I cannot afford to reboot the apache server since I am unable to know when the database has gone down for certain.  I am capturing the error codes from OCIError and can determine the cause, but am unable (due to user abilities on the Linux system) to reboot Apache with a script, etc.  Fix on this ASAP would be greatly appreciated.
 [2005-07-01 19:20 UTC] chung dot ley at amd dot com
Why does 4.3.10 not have this problem?  Is it because it is doing the ociping() or similar which means that its performance is less than the 5.0?  Or just that the 5.0.x has special optimization with using the Oracle internal library?

What is the status of the fix?  Will it be in the next release or maybe the next next release?  How can I help to push the priority of the fix?  I perfer not to use 4.3.10 because I will need to re-test all my applications on 4.3.10, and I also prefer not to uncomment ociping() so that I don't have to degrade the performance...  In other words, I want everything :DDD

 [2005-07-13 09:30 UTC] ecervetti at ch-hyeres dot fr
I use php 5.0.4 On mandrake linux, the bug remains;
but I can't see any ociping() function in oci8.c !!!!
 [2005-07-22 21:41 UTC] bradpover at gmail dot com
I too would appreciate a quick fix to this feature (what does the suspended status mean?). I see the error message using PHP 5.0.4, Apache 2.0.54 on win2k talking to a remote Oracle 10g database through Instant Client.

BTW the suggestion to uncomment out ociping() in ori8.c may be for oci_ping() instead?  That's what's in the win php5 source anyway. I just need a compiler now (the ms visual c++ toolkit 2003 does not include msdev which is needed to build resolv.lib - what a thing to find out _after_ downloading and installing 1GB of mostly not needed packages). 

On the brighter side I am running windows so system crashes and reboots will make my admin job easier for once. :)
 [2005-07-25 13:17 UTC] jfbustarret at tf1 dot fr
I had the same problem and wrote a small patch :

It adds a oci8.ping_freq php.ini variable (oci8.ping_freq = 60 is a good start).
 [2005-09-08 11:50 UTC]
The bug has been fixed in OCI8 v.1.1, which is available in CVS HEAD and PECL (use `pear install oci8-beta` to install it).
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Mar 26 03:03:47 2023 UTC