You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

For the Key Tracker project, we used the Web Server Development Suite for a Windows development environment (a.k.a. "the WAMP stack").

Here are the steps it took to make PHP speak to Oracle on Windows.

0. This WAMP came with PHP compiled with the Oracle option, and with the dlls in the extension library. If your PHP came from somewhere else, consult http://php.net:PHP.net or <U>Programming PHP</U> by Lerdorf and Tatroe for more information.

1. Enable Oracle extension in PHP.
Open php.ini in an editor. In the windows extensions section, uncomment
extension=php_oci8.dll
and save your changes. Notice that this dll is already present in the WAMP stack in the /php5/extensions directory.

2. Install the Oracle client.
The Oracle client may be downloaded from the Supported Windows Software page. Add your connection info to tnsnames.ora if it isn't already there.

Confirm that you can connect with sqlplus, the Oracle query tool that comes with the client.

Many pages say one can install the Oracle Instant Client. This doesn't come with a tnsnames.ora file, and I couldn't find examples of connecting without a tnsnames.ora file. You may wish to take this path, but this HOWTO assumes you've installed the normal Oracle client.

3. Make a test script so you'll know when it works.

<?php

  if( $db = oci_connect('oracle_login', 'oracle_pwd', 'entry name from tnsnames.ora'))
  {
    echo "Success!";
    oci_close($db);
  } else {
    echo "Failure, could not connect.";
  }

?>

  • No labels