Jump to content

Recommended Posts

Hi all,

 

I'm an italian programmer and i have a very big problem: i must connect to Oracle DB.

 

The error log is:

 

Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in /var/www/phpnuke/html/modules/FAQ/index.php on line 266

Errore nella scelta del database

 

The code is:

 

  PutEnv("ORACLE_SID=XE");

  PutEnv("ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server");

  PutEnv("TNS_ADMIN=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin");

 

  $db = "XE";

 

  $sql = "SELECT * FROM DEFECT";

 

  $cn = OCILogon("smc","smc",$db)or die('Errore nella scelta del database');

       

  $stmt = OCIParse($cn,$sql) or die ("Couldn't parse statement.");

 

  OCIExecute($stmt) or die ("Couldn't execute query.");

 

   

    while (OCIFetchInto ($stmt, $row, OCI_ASSOC)) {

 

    print "ID: ".$row[iD]."<br>";

  }

 

 

  OCIFreeStatement($stmt);

  OCILogoff($cn);

 

 

Can you help me? I offer a ham on Christmas Time the first one that help me ;)

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/69390-php-oracle-db/
Share on other sites

  • 2 weeks later...

 

Avoid using putenv() because it is error prone, inconsistent, and unportable.  Make sure the environment is set in the shell that starts Apache.

 

There is a bunch of other information in my free Underground PHP and Oracle Manual at http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf

 

-- cj

Link to comment
https://forums.phpfreaks.com/topic/69390-php-oracle-db/#findComment-355276
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.