I am building an application for our intranet I need to connect to our oracle database. The Web Server is windows and IIS. PHP is installed and working correctly, also the OCI8 extension is enabled and working correctly. The Database Server is running off a Linux box and is ORacle 9i. I tried a quick OCILogon and got some TNS error. I didn't set an environment variables yet.

2 Questions

What environment variables do I need to set? The webserver and dataserver are on different machines, I'm not sure if that makes a diiference.

Can I set them in the PHP script using putenv(); or do I have to hard code it somewhere?

From what I have found on PHP's site I need to set these variables

ORACLE_HOME
ORACLE_BASE
NLS_LANG
ORA_NLS33
ORACLE_TERM
LD_LIBRARY_PATH

are there any others that you are aware of ? Thanks in advance.

    2 months later

    I have been searching for nearly the identical answer. I am not sure that simply setting environment variables will do the trick. I found some good advice at http://us3.php.net/manual/en/function.ocilogon.php

    I suggest you look it over. The example cited describes your (our) problem very well and prescribes a solution. Based on his URL's though, his db server is the same box as his web server. You and I have seperate boxes.

    I tried creating a share on the db server and pointing the ORACLE_SID environment variable to it using a URL. Didn't help.

    I too, saw a recommendation to set all of the environment variables you mentioned, but I didn't know what values they should have.

    Have you had any luck?

    Thanks, Chris

      I set only two environment variables:

      putenv("ORACLE_HOME=d:\Oracle\ora92");
      putenv("ORACLE_SID=RIMSDev");

      In Start/Control Panel/Administrative Tools/Services, confirm that the Oracle<HomeName>TNSListener service is running.

      Also verify that you have sufficient NTFS permissions to run the page.

        You'll need to set your Oracle_SID env. variable to the name of your Oracle SID (not mine!)

          Write a Reply...