I'm trying to set up a server for a project in my databases class. I'll be writing the project in php, deploying it via apache, and connecting to a remote oracle server. I'm having trouble with the oracle connection portion. I have the OCI8 module installed with oracle's instantclient version 10.2. I thought it was working because when I ran the following program from the console I got the right output.
Program:
<?php
$conn = oci_connect("asdf", "asdf", "asdf");
if (!$conn) {
die("connection error\n");
}
$stid = oci_parse($conn, 'SELECT * FROM PARTS');
if (!$stid) {
die("statement parsing error\n");
}
$r = oci_execute($stid);
if (!$r) {
die("execution error\n");
}
print "<table border='1'\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print "<tr>\n";
foreach ($row as $item) {
print "\t<td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>\n";
}
print "</tr>\n";
}
print "</table>\n";
oci_free_statement($stid);
oci_close($conn);
?>
Result:
<table border='1'>
<tr>
<td>1</td>
<td>wrench</td>
<td>silver</td>
</tr>
<tr>
<td>2</td>
<td>hammer</td>
<td>brown</td>
</tr>
</table>
So I thought everything was fine. But when I visit the same php page in a browser I get the following error message:
Fatal error: Call to undefined function oci_connect() in /home/eric/apache2/htdocs/realestate/basicQuery.php on line 2
I thought that might mean that two different versions of php were getting used for the command line and in apache, so I ran phpinfo(); for both. But they both came back with the same php info (PHP Version 5.2.10-2ubuntu6.4). They are using different php.ini files (/etc/php5/apache2/php.ini and /etc/php5/cli/php.ini), but they both are exactly the same. I don't know where else to look for anything that might be different in one environment versus the other.
Thanks for any help!