<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <!-- FIRST example connecting to Oracle! by: Sharon Tuttle last modified: 2025-04-02 you can run this using the URL: https://nrs-projects.humboldt.edu/~st10/s25cs328/328lect10-2/try-oracle.php --> <head> <title> Oracle Demo 1 </title> <meta charset="utf-8" /> <?php ini_set('display_errors', 1); error_reporting(E_ALL); ?> <link href="https://nrs-projects.humboldt.edu/~st10/styles/normalize.css" type="text/css" rel="stylesheet" /> </head> <body> <h1> Our First Connection from PHP to Oracle! </h1> <!-- we happen to be using OCI, Oracle Call Interface, to connect PHP to Oracle --> <?php // oci_connect, to get a connection object from Oracle, // NEEDS several parameters $os_username = substr($_SERVER["CONTEXT_PREFIX"], 2); $ora_php_username = "{$os_username}_php"; $conn_username = "{$ora_php_username}[{$os_username}]"; $ora_php_password = trim(file_get_contents("/home/{$os_username}/.oraauth")); $conn = oci_connect(username: $conn_username, password: $ora_php_password, connection_string: null, encoding: 'AL32UTF8', session_mode: OCI_DEFAULT); $date_query_str = "select sysdate from dual"; $date_stmt = oci_parse($conn, $date_query_str); oci_execute($date_stmt, OCI_DEFAULT); oci_fetch($date_stmt); ?> <p> Today's date is <?= oci_result($date_stmt, 1) ?> </p> <?php oci_free_statement($date_stmt); oci_close($conn); ?> <footer> <hr /> <p> Validate by pasting .xhtml copy's URL into<br /> <a href="https://validator.w3.org/nu"> https://validator.w3.org/nu </a> or <a href="https://html5.validator.nu/"> https://html5.validator.nu/ </a> </p> </footer> </body> </html>