Fatal error: Call to undefined function OCILogon() in D:\wwwroot\testdb.php on line 3
We received this message on a server running Server 2003, IIS, PHP attempting to attach to an Oracle Server.
Some Prelims
1) Make a new app pool (we made one called PHP)
2) instead of an Isapi.dll simply edit the configuration (directory) on the properties of the site/virtual directory.
3) click configuration, add an extension mapping for the location of your isapi "D:\PHP\php5isapi.dll"
4) change the app pool of this site/virtual directory - to use the PHP app pool from #1. Supposedly this allows you to right- click on the app pool, click recycle & it will reload your php.ini file without taking down everything. In reality though, this didn't work & we still had to run (to get it to update):
net stop http /y
net start w3svc
5) Make sure PHP is in your allowed Web Service Extensions. This script (test.php) will confirm PHP is working:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>
2) check the 6th row in the above script's output
Configuration File (php.ini) Path C:\WINDOWS
3) This tells us PHP is looking to c:\windows for the php.ini. The second we copied our php.ini to that folder - everything started working.
4) use this script (testdb.php) to test your oracle connection:
<?php
if ($conn=OCILogon("username", "password", "DSN")) {
echo "Successfully connected to Oracle using OCI extension.\n";
OCILogoff($conn);
} else {
$err = OCIError();
echo "Error in connecting to the Oracle." . $err[text];
}
?>
But really, the bottom line was copying the php.ini file from d:\php to c:\windows.
No comments:
Post a Comment