Jump to content

PHP & Oracle DB


Cendler85

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.