Simple hello world Oracle + PHP + Windows problems
644759Oct 11 2010 — edited Dec 22 2010I'm trying to follow instructions for a simple connection to a Oracle database and it's been quite frustrating. Seen this error message?
- Downloaded PHP 5.3, unzipped
- Downloaded Apache, confirmed everything works, see php helloworld
- Attempt to follow http://www.oracle.com/technology/pub/notes/technote_php_instant.html
- Download instantclient_11_2 and unzip
- Set PATH to include instantclient_11_2 path
- Uncomment extension=php_oci8_11g.dll in php.ini
- Load phpInfo(), confirm oci enabled, (I see OCI8 Support : enabled)
- Write simple page to connect to remote oracle instance:
<?php
$conn = oci_connect("username", "password", "//remote.machine.name.goes.here:1521/DBNAME");
$query = 'select * from projects';
$stid = oci_parse($conn, $query);
oci_execute($stid, OCI_DEFAULT);
while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
foreach ($row as $item) {
echo $item." ";
}
echo "<br>\n";
}
oci_free_statement($stid);
oci_close($conn);
?>
Then I get this:
Warning: oci_connect() [function.oci-connect]: ORA-24315: illegal attribute type in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testphp.php on line 3
Warning: oci_parse() expects parameter 1 to be resource, boolean given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testphp.php on line 7
Warning: oci_execute() expects parameter 1 to be resource, null given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testphp.php on line 8
Warning: oci_fetch_array() expects parameter 1 to be resource, null given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testphp.php on line 9
Warning: oci_free_statement() expects parameter 1 to be resource, null given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testphp.php on line 16
Warning: oci_close() expects parameter 1 to be resource, boolean given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testphp.php on line 17
Win XP, Oracle 10g