|  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
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: dante dot lorenso at atmosenergy dot com
New email:
PHP Version: OS:


 [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) {
    // parse the SQL statement...
    $sql_statement = @OCIParse($dbconn, $sql);
    if (! $sql_statement) {

    // execute sql query
    $exec_result = @OCIExecute($sql_statement);
    if (! $exec_result) {

    // disconnect...

    // 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.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-12 04:58 UTC]
seems to work for me (oracle 
any chance i could get a login on your box to see the 
 [2002-09-12 04:58 UTC]
seems to work for me (oracle 
any chance i could get a login on your box to see the 
 [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:

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

Virtual Directory Support

Configuration File (php.ini) Path

Debug Build

Thread Safety
 [2002-09-13 11:59 UTC]
plz send me a minimal _SELF_CONTAINED_ (= complete) script 
that i can run on my dev-box.  
 [2002-10-08 21:43 UTC]
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
**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 Aug 17 04:05:45 2022 UTC