OCI8
PHP Manual

Installing/Configuring

Table of Contents

Requirements

You will need the Oracle client libraries to use this extension. Windows users will need libraries with version at least 10 to use the php_oci8.dll.

Note: This extension does not support Oracle 8 client libraries anymore. Though you still can connect to Oracle 8 servers as long as the client library (v.9+) supports this.

The most convenient way to install all the required files is to use Oracle Instant Client, which is available from here: » http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html. To work with OCI8 module "basic" version of Oracle Instant Client is enough. Instant Client does not need ORACLE_SID or ORACLE_HOME environment variables set. You still may need to set LD_LIBRARY_PATH and NLS_LANG, though.

Before using this extension, make sure that you have set up your Oracle environment variables properly for the Oracle user, as well as your web daemon user. These variables should be set up before you start your web-server. The variables you might need to set are as follows:

For less frequently used Oracle environment variables such as TNS_ADMIN, TWO_TASK, ORA_TZFILE, and the various Oracle globalization settings like ORA_NLS33, ORA_NLS10 and the NLS_* variables refer to Oracle documentation.

After setting up the environment variables for your web server user, be sure to also add the web server user (nobody, www) to the oracle group.

Note: If your web server doesn't start or crashes at startup
Check that Apache is linked with the pthread library:

# ldd /www/apache/bin/httpd
   libpthread.so.0 => /lib/libpthread.so.0 (0x4001c000)
   libm.so.6 => /lib/libm.so.6 (0x4002f000)
   libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004c000)
   libdl.so.2 => /lib/libdl.so.2 (0x4007a000)
   libc.so.6 => /lib/libc.so.6 (0x4007e000)
   /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

If the libpthread is not listed you have to reinstall Apache:
# cd /usr/src/apache_1.3.xx
# make clean
# LIBS=-lpthread ./config.status
# make
# make install

Please note that on some systems, like UnixWare it is libthread instead of libpthread. PHP and Apache have to be configured with EXTRA_LIBS=-lthread.


OCI8
PHP Manual