Skip to content

Instantly share code, notes, and snippets.

@lesstif
Created July 25, 2017 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesstif/5211b10ff8ab5644b15ebf40307593d2 to your computer and use it in GitHub Desktop.
Save lesstif/5211b10ff8ab5644b15ebf40307593d2 to your computer and use it in GitHub Desktop.
PHP oracle oci configuration test code.
<?php
$user = 'username';
$passwd = 'password';
// oracle ip or domain
$srv = 'oracle.host';
$sid = 'SID';
$port = 1521;
$conn = oci_connect($user, $passwd, "${srv}:${port}/${sid}", 'AL32UTF8');
if (!$conn) {
$e = oci_error();
die($e['message'] . "\n");
}
$stid = oci_parse($conn, 'SELECT sysdate FROM dual');
if (!oci_execute($stid)) {
$e = oci_error($stid);
die($e['message'] . "\n");
}
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
var_dump($row) . "\n";
}
oci_close($conn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment