Ver Mensaje Individual
  #20 (permalink)  
Antiguo 22/02/2006, 11:09
maurimono
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago de Chile
Mensajes: 504
Antigüedad: 19 años, 5 meses
Puntos: 0
Enabling the PHP OCI8 Extension on Windows

The Instant Client binaries complement PHP's prebuilt binaries for Windows.

Download the PHP binary zip file (not the installer build) and Apache. Install them following Installation on Windows Systems in the PHP Manual. OTN's Open Source Developer Center contains links to useful background material such as "Installing Oracle, PHP, and Apache on Windows 2000/XP," which covers installation of a traditional, full Oracle 10g footprint (which is not required with Instant Client).

Check that PHP is working before continuing. At this stage Oracle support is not enabled.

Download the Instant Client Basic package for Windows from the Instant Client page on OTN. The zip file is about 30MB in size.

Create a subdirectory (e.g., c:\instantclient10_1) and copy these libraries from the zip file:

oraociei10.dll
orannzsbb10.dll
oci.dll
Collectively these three files are about 80MB in size.

To use PHP's older "oracle" extension (enabled with "extension=php_oracle.dll" in php.ini), copy ociw32.dll instead of oci.dll.

Edit the environment and add c:\instantclient10_1 to PATH before any other Oracle directories.

For example, on Windows 2000, follow Start -> Settings -> Control Panel -> System -> Advanced -> Environment Variables and edit PATH in the System variables list.

If a tnsnames.ora file is used to define Oracle Net service names, copy tnsnames.ora to c:\instantclient10_1 and set the user environment variable TNS_ADMIN to c:\instantclient10_1. A default service name can optionally be set in the user environment variable LOCAL.

Set necessary Oracle globalization language environment variables such as NLS_LANG. If nothing is set, a default local environment will be assumed. See An Overview on Globalizing Oracle PHP Applications for more details.

Unset unnecessary Oracle variables such as ORACLE_HOME and ORACLE_SID.

Edit php.ini and uncomment the OCI8 extension:

extension=php_oci8.dll

Set the extension_dir directive to the full PHP extension DLL path. In PHP 4 the DLLs are in the "extensions" sub-directory of the PHP software. In PHP 5 they are in "ext".

Restart Apache.

To check the extension is configured, create a simple PHP script phpinfo.php where the web server can read it.

<?php
phpinfo();
?>

Load the script into a browser using an "http://" URL. The browser page should contain an "oci8" section saying "OCI8 Support enabled".