Hi
I'm in great need of help when connecting up to an oracle db on our intranet using php.
I've searched all over for help with this, but no luck.
We are runnig Oracle version 8 patch 8.151
I installed php with oracle support. phpinfo() returns the following:
oci8
OCI8 Support enabled
Revision $Revision: 1.104 $
oracle
Oracle Support enabled
I am using apache on my local machine (which runs windows). I have set the following in my httpd.conf file:
SetEnv ORACLE_HOME "C:\ORANT"
SetEnv TNS_ADMIN "C:\Temp\tnsnames.ora"
SetEnv ORACLE_SID "IRST1"
SetEnv TWO_TASK "C:\Temp\tnsnames.ora"
SetEnv NLS_LANG English_America.WE8ISO8859P1
SetEnv ORACLE_BASE C:\
I have also tried changing TNS_ADMIN and TWO_TASK to "C:\Temp\".
My php.ini file has the following:
extension=php_oci8.dll
extension=php_oracle.dll
My php.ini file does not have a section on paths, for example, like mySQL has under the heading [MySQL]. I guess this doesn't matter as these are set in httpd.conf as described above.
My php script is as below:
<<
<?php
$usr = "ben";
$pass = "pass";
$db = "IRST1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = servb)(PORT = 1521))
(CONNECT_DATA = (SID = IRST1))
)";
$connection = OCILogon($usr, $pass, $db);
print ("After connection");
$stmt = OCIParse($connection, "SELECT * FROM irs_owner.printtest");
OCIExecute($stmt);
?>
I have also tried a number of variations on this script such as just using the SID instead of the variable $db with the tnsnames string. I always get the same error which is:
_oci_open_server: Error while trying to retrieve text for error ORA-12154
I can log on with SQL*Plus from my machine using the same username, pass and SID.