Oracle 8i connectivity under PHP4 has to be one of THE hardest things to find help with. I have spent the last 2 days trying to get my Windows 98 PC running Apache 1.3.12 and PHP4.0.2 to connect to our Linux-based Oracle 8i server.

Firstly, I CAN connect using SQLPlus, I DO have the Oracle client installed (c:\oracle\ora81) and I DO have a correctly set-up and tested TNSNAMES.ORA (c:\oracle\ora81\network\admin).

I have not been able to establish a connection at all to this box via PHP. I have searched high and low for some sort of complete documentation on the process but have found nothing. I have followed as much instruction that I've been able to find so far, including setting ORACLE_BASE to c:\oracle, ORACLE_HOME to c:\oracle\ora81 and have even tried setting ORACLE_SID even though I believe that is for Oracle 8.0 or lower. All of these environment variables have been set in autoexec.bat, and even tried in httpd.conf using SetEnv directives.

Consistantly my connection attempts fail with the error message "Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in c:\Windows\Desktop\webs/test.php on line 5".

If anyone has any idea what the problem is I'd love to hear from you. Let me assure you its not something as simple as putting in the wrong Service name... I have read suggestions that say to try putting the fully qualified database name into the OCILogon command instead of the service name which I have also tried without success.

Thanks, and believe me... whoever solves this will be helping a LOT of people.... it seems to be something that happens to a great number of people without any solution as far as I have been able to tell so far.

TIA

Matt

    Just adding to this.... I have tailed the logfile listener.log on the Linux Oracle server to observe connection activity. When I test the connection via the Net8 Easy Config utility I can see the connections appearing in the log file. When I attempt to connect via Pinnacle nothing is logged. Seems to me as though a connection is not even being registered.

    Matt

      I'm hoping someone will reply to this soon as it is beginning to look like I'm holding an entire conversation with myself!

      Anyway, just read another suggestion and changed my connect string to:

      OCIInternalDebug(1);

      $conn = ocilogon("ais","pinnacle","(DESCRIPTION =
      (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = poracle)(PORT = 1521))
      )
      (CONNECT_DATA =
      (SID = poracle)
      )
      )");

      ...with SUCCESSFUL results. Now... I'm beginning to wonder whether PHP is simply not finding TNSNAMES.ORA.... any ideas why this would be so?

        Hi, Matt

        My problem not so far away from yours. Got same config : Apache+PHP4 on Win98, trying to access Oracle 7.3 on Unix machine.

        1/ Have u any idea : when I uncomment an extension in PHP.INI, I got no more response from PHP !!! First I thought there was a prob. with Oracle DLLs, but any other extension leads to the same point (except calendar.dll). I admit, I'm new to PHP, it's possible I forgot some basic setup point.

        Thanks for your tips

        Matt. (Matthias)

          10 days later

          Hello Matt,

          it seems that you have done a great detective job on this issue... Bravo !

          Do you have any document summarizing the whole process (including Oracle issues, Php oracle module installation ...) ? This would be very useful to many people, I am sure !

          I am trying an event more risky thing : setting up a whole development environment on a single Win 98 machine :
          - PHP4 + Apache (DONE)
          - Oracle light (TO DO)
          - PHP4 / oracle connection using oci (TODO)
          Do you think this is possible ? (I could also consider switching to NT, but still on a single PC, if needed).

          This might look crazy but... my wife is pregnant and she wants me to spend time at home rather than in the office...

          Your help would be really appreciated !

          Ronan

            Write a Reply...