faqts : Computers : Programming : Languages : PHP : Database Backed Sites : Oracle : Installation

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

50 of 58 people (86%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Can't connect to Oracle 7. PHP installed ok, so did SQL*Net, but in PHP get Warning: Cannot connect to Oracle: TNS-12XXX: Cannot resolve service name.
l install php and oracle on winnt.but when i call ora_logon use sqlnet, it connect db for local ,not

Aug 24th, 2001 23:44
suresh kc, Chun Du, Miguel Angel Campos, Thierrry Pouplin, Onno Benschop, joe qiao, Suresh KC


use this at the top of the file 
dl("php_oci8.dll");
it will solve your problem
comment out the extension=php_oci8.dll
as you are loading the library when the script is run
sample script
-------------
<?php
dl("php_oci8.dll");
PutEnv("ORACLE_SID=your_sid");
$connection = OCILogon ("username", "password");
$sql = "select sysdate from dual";
$cur = OCIParse($connection, $sql);
if($cur == false) {
        echo OCIError($cur)."<BR>";
}
$recset = OCIExecute($cur);
if($recset == false) {
        echo OCIError($cur). "<BR>";
}
while(OCIFetchInto($row)) {
        $today = $row[0];
        echo "The Date is ",$today, "<BR>";
}
OCILogoff ($connection);
?>
Hope this helps