php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19129 Oracle 'ORA-12541: TNS:no listener' causes OCI8 to break
Submitted: 2002-08-27 15:05 UTC Modified: 2002-10-08 21:43 UTC
Votes:6
Avg. Score:4.3 ± 0.9
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:1 (16.7%)
From: dante dot lorenso at atmosenergy dot com Assigned:
Status: No Feedback Package: OCI8 related
PHP Version: 4.2.1 OS: RedHat Linux 7.3
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-08-27 15:05 UTC] dante dot lorenso at atmosenergy dot com
I use the following code to loop through an array of SIDs for Oracle...and attempt to change the password for a given username on each Oracle database...

==================================================
foreach ($names as $SID => $CONN_SID) {
    // make a connection
    $dbconn = @OCINLogon($username, $old_password, $SID);
    if (! $dbconn) {
        $this->dumpError("ORAPASS[OCILogon]");
        continue;
    }
	
    // parse the SQL statement...
    $sql_statement = @OCIParse($dbconn, $sql);
    if (! $sql_statement) {
        error_log("ORAPASS[OCIParse]");
	@OCILogOff($dbconn);
	continue;
    }

    // execute sql query
    $exec_result = @OCIExecute($sql_statement);
    if (! $exec_result) {
        error_log("ORAPASS[OCIExecute]");
        @OCILogOff($dbconn);
        continue;
    }

    // disconnect...
    @OCILogOff($dbconn);
    unset($dbconn);

    // show the results...
    $text .= sprintf ('Success: %s<br>', $SID);
}
==================================================

However, for some reason if the SID I connect to results in the following OCIError:

        Failed: SID1 (ORA-12541: TNS:no listener)

Then, all subsequent OCINLogon or OCILogon calls will result in this error message:

        Failed: SID2 (ORA-12154: TNS:could not resolve service name)

If I restart Apache/PHP and connect to SID2, it will work, but if I connect to any SID after getting the 'ORA-12541: TNS:no listener' error, my Oracle connections all fail.

--Dante

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-12 04:58 UTC] thies@php.net
seems to work for me (oracle 9.2.0.1) 
 
any chance i could get a login on your box to see the 
problem? 
 
 
 [2002-09-12 04:58 UTC] thies@php.net
seems to work for me (oracle 9.2.0.1) 
 
any chance i could get a login on your box to see the 
problem? 
 
 
 [2002-09-12 09:20 UTC] dante dot lorenso at atmosenergy dot com
I can't let you inside the firewall to see the problem first-hand, but I'll run any tests you want.  Here is some phpinfo() for you:


----------
System
----------
Linux dfw1wu19 2.4.18-5 #1 Mon Jun 10 15:31:48 EDT 2002 i686 unknown 


----------
Build Date
----------
Jul 10 2002 11:11:19 


----------
Configure Command
----------
'./configure' '--with-oracle=/opt/app/oracle/product/8.1.5' '--with-oci8=/opt/app/oracle/product/8.1.5' '--enable-sigchild' '--with-ldap' '--with-gd' '--with-config-file-path=/www/apache/conf/php' '--with-apache=../apache_1.3.26/' '--enable-track-vars' '--enable-bcmath' '--enable-ftp' 


----------
Server API
----------
Apache 


----------
Virtual Directory Support
----------
disabled 


----------
Configuration File (php.ini) Path
----------
/www/apache-1.3.26_ssl/conf/php/php.ini 


----------
Debug Build
----------
no 


----------
Thread Safety
----------
disabled
 [2002-09-13 11:59 UTC] thies@php.net
plz send me a minimal _SELF_CONTAINED_ (= complete) script 
that i can run on my dev-box.  
 [2002-10-08 21:43 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-11-25 05:24 UTC] p dot m at iol dot it
I experienced the identical problem with Oracle 8.1.5 and various PHP/apache combinations (in particular RedHat9 + Apache 2.0.47 + PHP 4.3.3).
My solution is to place in the loop a (failing) call to
OCINLogon(sameuser,samepass)
**with no SID argument**
after *every* failed logon attempt.
My opinion is that for some reason PHP uses the previous SID/tnsnames arguments without noticing they are changed.
If you omit them PHP is forced to try the (undefined) ORACLE_SID environment variable and after getting the error:
****ocinlogon(): OCISessionBegin: ORA-07200:****
****slsid: oracle_sid not set****
it has cleaned his memory.
Hope this helps.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jul 06 04:05:45 2022 UTC