note 9398 deleted from ref.oracle by sniper

From: Date: Mon, 11 Aug 2003 05:06:32 +0000
Subject: note 9398 deleted from ref.oracle by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53841@lists.php.net to get a copy of this message
Note Submitter: vishalrajpara@usa.net ---- vishal rajpara ( prangya) (203.199.79.124) Date: 2000-10-20 09:56:32 hi everybody, i find somesolutions for oracle php connectivity follow the belove steps: Note:my server is Redhat6.0/Oracle8.1.5/Php4-beta/Apache.12 etc 1)run dbstart now one imp thing is other group or server cant access data so its access problem so put this line in to your script: PutEnv("ORACLE_SID=<your oracle sid"); PutEnv("ORACLE_HOME=/opt/oracle/product/8.1.5"); Now check it out its working or not: if not put also this 2 line in code and check it. PutEnv("TNS_ADMIN=/opt/oracle/product/8.1.5/network/admin"); Now here is my tnsnames.ora file pls check it out docs which is inside yout $ORACLE_HOME/network/Doc pls read all information from all file here u find some good information. Here is my tnsnames.ora and sql.ora files 1)tnsnames.ora 1 # TNSNAMES.ORA Configuration File:/opt/oracle/product/8.1.5/network/admin/tnsnames.ora 2 # Generated by Oracle Net8 Assistant 3 4 ORACLE.PRANGYA.COM = 5 (DESCRIPTION = 6 (failover=on)(load_balance=off) 7 (ADDRESS_LIST = 8 (ADDRESS = (PROTOCOL = TCP)(HOST = krishna.prangya.com)(PORT = 1521)) 9 ) 10 (CONNECT_DATA = 11 (SID = oracle) 12 ) 13 ) 14 EXTPROC_CONNECTION_DATA = 15 (DESCRIPTION = 16 (ADDRESS_LIST = 17 (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) 18 ) 19 (CONNECT_DATA = 20 (SID = PLSExtProc) 21 (PRESENTATION = RO) 22 ) 23 ) now 2) # SQLNET.ORA Configuration File:/opt/oracle/product/8.1.5/network/admin/sqlnet.ora 2 # Generated by Oracle Net8 Assistant 3 4 NAMES.DEFAULT_DOMAIN = love.prangya.com 6 7 NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME) 8 automatic_ipc= off ~ now important thing is start $lsnrctl start $lsnrctl dbsnmp_start $tnslsnr start $tnsping <your service name> now run your php scipt its working of not check it out 1)first check that $sqlplus system/manager SQL>create tabel emp(name char(20), city char(20)); SQL>try to insert into table one record for checking SQL> exit now here is my php script which i use it for testing connection ##############################My Php Script## &lt;?php 2 PutEnv("ORACLE_SID=oracle"); 3 PutEnv("ORACLE_HOME=/opt/oracle/product/8.1.5"); 4 #PutEnv("TWO_TASK=/opt/oracle/product/8.1.5/network/admin/tnsnames.ora"); 5 #PutEnv("ORA_NLS=/opt/oracle/product/8.1.5/ocommon/nls/admin/data"); 6 7 8 echo "DEBUG:--->connecting oracle<BR>"; 9 echo "DEBUG:--11111--------------------------<><BR>"; 10 $connection = OCIPLogon("system","manager"); 11 if ($connection == false){ 12 echo "DEBUG:------2222----------------------<><BR>"; 13 echo OCIError($connection).":".OCIError($connection)."<BR>"; 14 exit; 15 } 16 17 18 #$query = "insert into emp values ('kamal','pappu')"; 19 $query = "select * from emp"; 20 $cursor = OCIParse($connection, $query); 21 if ($cursor == false){ 22 echo OCIError($cursor).":".OCIError($cursor)."<BR>"; 23 exit; 24 } 25 26 $result = OCIExecute($cursor); 27 if ($result == false){ 28 echo OCIError($cursor).":".OCIError($cursor)."<BR>"; 29 exit; 30 } 31 32 while (OCIFetchInto($cursor,$value)){ 33 $name = $value[0]; 34 $sname = $value[1]; 35 36 echo "DEBUG : value of name : $name and sname: $sname<BR>"; 37 } 38 39 OCICommit($connection); 40 OCILogoff($connection); 41 42 echo "DEBUG:--->insert sucessfully in oracle<BR>"; 43 ?> pls remove line no. its only for help for sequance of line here is all the things i put it if any problem pls mail me on "vishal@javazone.4mg.com"

« previous php.notes (#53841) next »