I am having trouble logging onto Oracle via PHP on a Windows 2000 machine.
I keep getting the error:
Fatal error: Call to undefined function OCILogon() in C:\Program Files\Apache Group\Apache2\htdocs\oraconnect.php on line 15
I seem to have everything set up correctly. I am running an Oracle 9i client and have set up the php.ini file with "extension=php_oci8.dll" uncommented, left ";extension=php_oracle.dll" commented. (Although I have tried various combinations of these two. Also I have set the "extension_dir = C:\Program Files\PHP\ext" correctly and noted that php_oci8.dll and php_oracle.dll exist there.
Now here is where it gets really weird and I could use some help:
It works fine from the command line:
possibly the cli version of php is using a different ini file than the
apache2 module/cgi. also you made need to restart apache in order to reread the php.ini file.
with regard to putenv() - you may be suffering from safe_mode being on.
also, (I don't know this!), if putenv is setting env vars whose scope is server-process wide then concurrent scripts _maybe_ messing each other up: e.g. request1 starts and does some putenv()s, request2 does the same a fraction later, request1 finishes and resets stuff done by putenv(), request2 trys to connect...which fails because the env vars are empty.
I type "php oraconnect.php" for the following code: <?php //putenv("ORACLE_SID=TESTDB"); //putenv("ORACLE_HOME=C:/oracle/ora92"); //putenv("TNS_ADMIN=C:/oracle/ora92/network/admin"); $username = "SCOTT"; $passwd = "TIGER"; //$db="(DESCRIPTION= // (ADDRESS_LIST= // (ADDRESS=(PROTOCOL=TCP) // (HOST=orahostname1)(PORT=1621) // ) // ) // (CONNECT_DATA=(SERVICE_NAME=TESTDB)) // )"; $conn = OCILogon("SCOTT","TIGER","TESTDB"); if (!$conn) { echo "Connection failed"; echo "Error Message: [" . OCIError($conn) . "]"; exit; } else { echo "Connected!"; } ?>
It works either way with the env_variables in the script or with them commented out from the command line. I just can't get it to work from the browser.
Can anyone out there help me with this one? I have some experience with Oracle, Perl, and a little Java but not so much with PHP.
Thanks.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php