Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: OCI8 - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

oci_bind_array_by_name" width="11" height="7"/> <overload
Last updated: Sun, 25 Nov 2007

view this page in

Oracle 関数

導入

これらの関数は Oracle コールインターフェース (OCI) を使用した Oracle 10, Oracle 9, Oracle 8, そして Oracle 7 データベースへのアクセスを可能にします。 これらは PHP 変数の Oracle プレースホルダへのバインドをサポートし、 LOB、FILE、ROWID を完全にサポートしており、 ユーザー定義の変数が使用可能です。

要件

この拡張を使用するために Oracle クライアントライブラリが必要になります。 Windows ユーザは php_oci8.dll を使用するために 少なくともバージョン 10 以降のライブラリが必要になるでしょう。

注意: この拡張モジュールは、Oracle 8 のクライアントライブラリをサポートしません。 とはいえ、バージョン 9 以降のクライアントライブラリが Oracle 8 サーバへの接続をサポートする限りは Oracle 8 サーバに接続することが可能です。

要求される全てのファイルをインストールする最も簡便な方法は、 Oracle Instant Client を使用することです。これは » http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html から取得可能です。 OCI8 モジュールを動作させるには、Oracle Instant Client の 「基本 (basic)」バージョンを導入するだけで十分です。 Instant Client は ORACLE_SID もしくは ORACLE_HOME 環境変数を設定する必要がありませんが、LD_LIBRARY_PATH と NLS_LANG を設定する必要があります。

この拡張モジュールを使用する前に Web デーモンのユーザでもある Oracle ユーザに対する Oracle 用環境変数が正しく設定されていることを 確認してください。これらの変数は Web サーバを起動する 前に 設定されていなければなりません。 設定されている必要がある変数を以下に示します。

  • ORACLE_HOME
  • ORACLE_SID
  • LD_PRELOAD
  • LD_LIBRARY_PATH
  • NLS_LANG
頻繁にはないですが、TNS_ADMIN, TWO_TASK, ORA_TZFILE、 そして ORA_NLS33, ORA_NLS10 あるいは NLS_* のような様々な Oracle の国際化設定用の変数を使用する場合は、 Oracle のドキュメントを参照してください。

Web サーバーのユーザ用に環境変数を設定した後、Web サーバーのユーザ (nobody, www) をグループ oracle に追加してください。

注意: Web サーバが起動しないか、起動時にクラッシュする場合 Apache が pthread ライブラリにリンクされているかどうか 次のように確認してください。

# 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)

libpthread がこの一覧にない場合、Apache を再インストールする必要があります。
# cd /usr/src/apache_1.3.xx
# make clean
# LIBS=-lpthread ./config.status
# make
# make install

UnixWare のようないくつかのシステムでは、libpthread の代わりに libthread が使用されています。その場合、PHP と Apache は、 EXTRA_LIBS=-lthread を configure に指定する必要があります。

実行時設定

php.ini の設定により動作が変化します。

OCI8 設定オプション
名称 デフォルト 変更可否 変更履歴
oci8.privileged_connect "0" PHP_INI_SYSTEM PHP 5.1.2 以降で使用可能
oci8.max_persistent "-1" PHP_INI_SYSTEM PHP 5.1.2 以降で使用可能
oci8.persistent_timeout "-1" PHP_INI_SYSTEM PHP 5.1.2 以降で使用可能
oci8.ping_interval "60" PHP_INI_SYSTEM PHP 5.1.2 以降で使用可能
oci8.statement_cache_size "20" PHP_INI_SYSTEM PHP 5.1.2 以降で使用可能
oci8.default_prefetch "10" PHP_INI_SYSTEM PHP 5.1.2 以降で使用可能
oci8.old_oci_close_semantics "0" PHP_INI_SYSTEM PHP 5.1.2 以降で使用可能

以下に設定ディレクティブに関する 簡単な説明を示します。

oci8.privileged_connect boolean

このオプションは外部の信用 (OCI_SYSOPER, OCI_SYSDBA) を利用して権限付きの接続を有効にします。

oci8.max_persistent int

プロセスあたりの永続的な OCI8 接続の最大値を指定します。 このオプションを -1 に設定することは、制限なしを意味します。

oci8.persistent_timeout int

与えられたプロセスがアイドル状態の永続的接続を維持する最大時間 (秒単位) を指定します。 このオプションを -1 に設定することは、 アイドル状態の永続的接続は永久に維持されることを意味します。

oci8.ping_interval int

oci_pconnect() の間、ping を発行するまでに経過させる時間 (秒単位) を指定します。 0 に設定した場合、永続的接続は再利用される度に ping を発行します。 ping を完全に無効にするためには、このオプションを -1 に設定します。

注意: ping を無効にすることで oci_pconnect() は最高の効率で処理をコールしますが、ネットワークが分断された場合や PHP が接続した後に Oracle サーバがダウンし、 その後に実行されるスクリプト中において PHP が接続の失敗を検知しなくなります。 詳細な情報は oci_pconnect() を参照ください。

oci8.statement_cache_size int

このオプションはステートメントキャッシュを有効にします。 また、キャッシュするステートメントの数を指定します。 ステートメントキャッシュを無効にする場合、このオプションを 0 に設定してください。

注意: より大きなキャッシュは、メモリ使用量の増加と引き替えに パフォーマンスの改善をもたらします。

oci8.default_prefetch int

このオプションはステートメントのプリフェッチを有効にし、 ステートメントの実行後自動的にフェッチされるデフォルトの行数を 設定します。

注意: より大きなプリフェッチは、メモリ使用量の増加と引き替えに パフォーマンスの改善をもたらします。

oci8.old_oci_close_semantics boolean

このオプションは oci_close() の動作を制御します。有効にすると、oci_close() は何も行いません。接続はスクリプトの終了まで閉じられません。 これは後方互換性のためのみに存在しています。 この設定を有効にする必要があると判明した場合、 このオプションを有効にする代わりに、 oci_close() をアプリケーションから削除することが 強く推奨されます。

定義済み定数

以下の定数が定義されています。 この関数の拡張モジュールが PHP 組み込みでコンパイルされているか、 実行時に動的にロードされている場合のみ使用可能です。

OCI_DEFAULT (integer)
文の実行モードを指定します。 このモードを使用する場合、 文は自動的にコミットされません。
OCI_DESCRIBE_ONLY (integer)
文の実行モードを指定します。 実際に文を実行したくないが取得一覧の記述は取得したい場合に このモードを使用してください。
OCI_COMMIT_ON_SUCCESS (integer)
文の実行モードを指定します。 文は、oci_execute() コールの後に自動的にコミットされます。
OCI_EXACT_FETCH (integer)
文の取得モードを指定します。 アプリケーションがあらかじめ何行取得すればよいか分かっている場合に 使用されます。 このモードは Oracle リリース 8 以降ではプリフェッチ機能をオフにします。 カーソルは希望する行を取得した後キャンセルされ、 サーバ側のリソースの使用は軽減されます。
OCI_SYSDATE (integer)
OCI_B_BFILE (integer)
oci_bind_by_name() で BFILE をバインドする場合に使用されます。
OCI_B_CFILEE (integer)
oci_bind_by_name() で CFILE をバインドする場合に使用されます。
OCI_B_CLOB (integer)
oci_bind_by_name() で CLOB をバインドする場合に使用されます。
OCI_B_BLOB (integer)
oci_bind_by_name() で BLOB をバインドする場合に使用されます。
OCI_B_ROWID (integer)
oci_bind_by_name() で ROWID をバインドする場合に使用されます。
OCI_B_CURSOR (integer)
oci_bind_by_name()oci_new_descriptor() によってあらかじめ割り当てられたカーソルをバインドする場合に使用されます。
OCI_B_NTY (integer)
oci_bind_by_name() で 名前付けされたデータ型をバインドする場合に使用されます。 注意: PHP < 5.0 では OCI_B_SQLT_NTY と呼ばれます。
OCI_B_BIN (integer)
SQLT_BFILEE (integer)
OCI_B_BFILE と等価です。
SQLT_CFILEE (integer)
OCI_B_CFILEE と等価です。
SQLT_CLOB (integer)
OCI_B_CLOB と等価です。
SQLT_BLOB (integer)
OCI_B_BLOB と等価です。
SQLT_RDD (integer)
OCI_B_ROWID と等価です。
SQLT_NTY (integer)
OCI_B_NTY と等価です。
SQLT_LNG (integer)
oci_bind_by_name() で LONG 値をバインドする際に使用されます。
SQLT_LBI (integer)
oci_bind_by_name() で LONG RAW 値をバインドする際に使用されます。
SQLT_BIN (integer)
oci_bind_by_name() で RAW 値をバインドする際に使用されます。
SQLT_NUM (integer)
oci_bind_array_by_name() で NUMBER の配列をバインドする場合に使用されます。
SQLT_INT (integer)
oci_bind_array_by_name() で INTEGER の配列をバインドする場合に使用されます。
SQLT_AFC (integer)
oci_bind_array_by_name() で CHAR の配列をバインドする場合に使用されます。
SQLT_CHR (integer)
oci_bind_array_by_name() で VARCHAR2 の配列をバインドする場合に使用されます。 oci_bind_by_name() でも使用されます。
SQLT_VCS (integer)
oci_bind_array_by_name() で VARCHAR の配列をバインドする際に使用されます。
SQLT_AVC (integer)
oci_bind_array_by_name() で CHARZ の配列をバインドする場合に使用されます。
SQLT_STR (integer)
oci_bind_array_by_name() で STRING の配列をバインドする場合に使用されます。
SQLT_LVC (integer)
oci_bind_array_by_name() で LONG VARCHAR の配列をバインドする場合に使用されます。
SQLT_FLT (integer)
oci_bind_array_by_name() で FLOAT の配列をバインドする場合に使用されます。
SQLT_ODT (integer)
oci_bind_array_by_name() で LONG の配列をバインドする場合に使用されます。
SQLT_BDOUBLE (integer)
SQLT_BFLOAT (integer)
OCI_FETCHSTATEMENT_BY_COLUMN (integer)
oci_fetch_all() のデフォルトのモードです。
OCI_FETCHSTATEMENT_BY_ROW (integer)
oci_fetch_all() でのもうひとつのモードです。
OCI_ASSOC (integer)
oci_fetch_all()oci_fetch_array() で結果を連想配列で取得するために使用されます。
OCI_NUM (integer)
oci_fetch_all()oci_fetch_array() で結果を配列で取得するために使用されます。
OCI_BOTH (integer)
oci_fetch_all()oci_fetch_array() で結果を配列と連想配列の両方で取得するために使用されます。
OCI_RETURN_NULLS (integer)
oci_fetch_array() でフィールド値が NULL の場合に空の配列要素を取得するために使用されます。
OCI_RETURN_LOBS (integer)
oci_fetch_array() でディスクリプタの代わりに LOB の値を取得するために使用されます。
OCI_DTYPE_FILE (integer)
このフラグは oci_new_descriptor() に新しい FILE ディスクリプタを初期化するように伝えます。
OCI_DTYPE_LOB (integer)
このフラグは oci_new_descriptor() に新しい LOB ディスクリプタを初期化するように伝えます。
OCI_DTYPE_ROWID (integer)
このフラグは oci_new_descriptor() に新しい ROWID ディスクリプタを初期化するように伝えます。
OCI_D_FILE (integer)
OCI_DTYPE_FILE と等価です。
OCI_D_LOB (integer)
OCI_DTYPE_LOB と等価です。
OCI_D_ROWID (integer)
OCI_DTYPE_ROWID と等価です。
OCI_SYSOPER (integer)
外部の信任を使用する SYSOPER として接続するために oci_connect() と併用します (これには oci8.privileged_connect を有効にすべきです) 。
OCI_SYSDBA (integer)
外部の信任を使用する SYSDBA として接続するために oci_connect() と併用します (これには oci8.privileged_connect を有効にすべきです) 。
OCI_LOB_BUFFER_FREE (integer)
使用されたバッファを解放するために OCI-Lob->flush と併用します。
OCI_TEMP_CLOB (integer)
一時的な CLOB が生成されるよう明示的に指定するため OCI-Lob->writeTemporary と併用します。
OCI_TEMP_BLOB (integer)
一時的な BLOB が生成されるよう明示的に指定するため OCI-Lob->writeTemporary と併用します。

Example#1 基本的なクエリ

<?php

  $conn 
oci_connect('hr''hr''orcl');
  if (!
$conn) {
    
$e oci_error();
    print 
htmlentities($e['message']);
    exit;
  }

  
$query 'SELECT * FROM DEPARTMENTS';

  
$stid oci_parse($conn$query);
  if (!
$stid) {
    
$e oci_error($conn);
    print 
htmlentities($e['message']);
    exit;
  }

  
$r oci_execute($stidOCI_DEFAULT);
  if (!
$r) {
    
$e oci_error($stid);
    echo 
htmlentities($e['message']);
    exit;
  }

  print 
'<table border="1">';
  while (
$row oci_fetch_array($stidOCI_RETURN_NULLS)) {
    print 
'<tr>';
       foreach (
$row as $item) {
         print 
'<td>'.($item?htmlentities($item):'&nbsp;').'</td>';
       }
       print 
'</tr>';
  }
  print 
'</table>';

  
oci_close($conn);
?>

Example#2 バインド変数を用いた挿入

<?php

  
// 実行前に表を作成する
  //   CREATE TABLE MYTABLE (mid NUMBER, myd VARCHAR2(20));

  
$conn oci_connect('scott''tiger''orcl');

  
$query 'INSERT INTO MYTABLE VALUES(:myid, :mydata)';

  
$stid oci_parse($conn$query);

  
$id 60;
  
$data 'Some data';

  
oci_bind_by_name($stid':myid'$id);
  
oci_bind_by_name($stid':mydata'$data);

  
$r oci_execute($stid);

  if (
$r)
    print 
"One row inserted";

  
oci_close($conn);

?>

Example#3 CLOB カラムにデータを挿入する

<?php

// 実行前に表を作成する
//     CREATE TABLE MYTABLE (mykey NUMBER, myclob CLOB);

$conn oci_connect('scott''tiger''orcl');

$mykey 12343;  // この例で用いる任意のキー

$sql "INSERT INTO mytable (mykey, myclob)
        VALUES (:mykey, EMPTY_CLOB())
        RETURNING myclob INTO :myclob"
;

$stid oci_parse($conn$sql);
$clob oci_new_descriptor($connOCI_D_LOB);
oci_bind_by_name($stid":mykey"$mykey5);
oci_bind_by_name($stid":myclob"$clob, -1OCI_B_CLOB);
oci_execute($stidOCI_DEFAULT);
$clob->save("A very long string");

oci_commit($conn);

// CLOB データをフェッチする

$query 'SELECT myclob FROM mytable WHERE mykey = :mykey';

$stid oci_parse ($conn$query);
oci_bind_by_name($stid":mykey"$mykey5);
oci_execute($stidOCI_DEFAULT);

print 
'<table border="1">';
while (
$row oci_fetch_array($stidOCI_ASSOC)) {
  
$result $row['MYCLOB']->load();
  print 
'<tr><td>'.$result.'</td></tr>';
}
print 
'</table>';

?>

コマンドラインで実行するのと同様な手法により、ストアドプロシージャ に簡単にアクセス可能です。

Example#4 ストアドプロシージャの使用法

<?php
// by webmaster at remoterealty dot com
$sth oci_parse($dbh"begin sp_newaddress( :address_id, '$firstname',
 '$lastname', '$company', '$address1', '$address2', '$city', '$state',
 '$postalcode', '$country', :error_code );end;"
);

// この命令は、:address_id を入出力変数、:error_code を出力変数として
// ストアドプロシージャ sp_newaddress をコールします。
// 続いて、以下のようにバインドを実行します。

   
oci_bind_by_name($sth":address_id"$addr_id10);
   
oci_bind_by_name($sth":error_code"$errorcode10);
   
oci_execute($sth);

?>

接続のハンドリング

oci8 拡張モジュールは Oracle に接続するための 3 つの異なる関数を提供しています。 アプリケーションに最適な関数を使用するのはあなた次第です。 また、このセクションにある情報は、 インフォームド・チョイス (十分な説明を受けよく考えた上での選択) を行う助けになることを目的としています。

Oracle サーバへの接続は、完了まで要する時間という点から見ると、 かなりコストのかかる操作です。oci_pconnect() 関数は、 異なるスクリプトリクエスト間で接続の再利用が可能な 持続的キャッシュを使用します。 これは、PHP プロセス (もしくは Apache の子プロセス) 毎の接続に関するオーバーヘッドを一度のみ負うということを意味しています。

もしアプリケーションが信用された異なる Web ユーザー毎に Oracle に接続する場合、oci_pconnect() による持続的キャッシュは、 同時ユーザー数の増加と共に有効ではなくなるでしょう。 これは、多くのアイドル状態の接続が維持されることが原因で、 Oracle サーバ全体のパフォーマンスに不利な影響を与え始めるためです。 もしアプリケーションがこの方法で構成されている場合、 oci8.max_persistentoci8.persistent_timeout (持続的接続のキャッシュサイズや生存期間の制御が可能になります) を使用してアプリケーションをチューニングする、もしくは代わりに oci_connect() を使用することが推奨されます。

oci_connect()oci_pconnect() の両者とも接続キャッシュを使用します。もし、同一パラメータと共に oci_connect() を複数回コールする場合、 2 番目以降は既存の接続ハンドルを返します。oci_connect() によって使用されるキャッシュは、スクリプト実行終了時、 もしくは明示的に接続ハンドルを閉じた時にクリアされます。 oci_pconnect() も同様の動作をしますが、 キャッシュは独立して維持され、リクエスト間で残存します。

このキャッシュ機能は忘れてはならないほど重要です。 それは、2 つのハンドルがトランザクション的に独立していない (実際には同じ接続なので、どのような種類の独立もありません) ためです。もしアプリケーションが 2 つの別々でトランザクション的に独立した接続を必要とする場合、 oci_new_connect() を使用すべきです。

oci_new_connect() は、他の既存の接続が存在したとしても 常に Oracle サーバへの新規接続を生成します。 特にアプリケーションの最も負荷が高い部分など、 高トラフィックな Web アプリケーションに対しては oci_new_connect() の使用を避けてください。

ドライバでサポートされるデータ型

oci_bind_by_name() 関数を使用してパラメータをバインドする場合、 ドライバは次の型をサポートします
マッピング
SQLT_NTY oci_new_collection() によって生成されたような PHP のコレクションオブジェクトからネイティブのコレクション型に マップします
SQLT_BFILEE oci_new_descriptor() によって生成されたような PHP のディスクリプタオブジェクトからネイティブのディスクリプタ型に マップします
SQLT_CFILEE oci_new_descriptor() によって生成されたような PHP のディスクリプタオブジェクトからネイティブのディスクリプタ型に マップします
SQLT_CLOB oci_new_descriptor() によって生成されたような PHP のディスクリプタオブジェクトからネイティブのディスクリプタ型に マップします
SQLT_BLOB oci_new_descriptor() によって生成されたような PHP のディスクリプタオブジェクトからネイティブのディスクリプタ型に マップします
SQLT_RDD oci_new_descriptor() によって生成されたような PHP のディスクリプタオブジェクトからネイティブのディスクリプタ型に マップします
SQLT_NUM PHP パラメータを 'C' の long 型に変換し、 その値をバインドします
SQLT_RSET oci_parse() によって生成されたもしくは他の OCI クエリから処理されたような PHP のステートメントハンドルからネイティブのステートメントハンドルに マップします
SQLT_CHR や他の型 PHP パラメータを文字列型に変換し、その文字列をバインドします
以下の型は結果セットからカラムを処理する際にサポートされます
マッピング
SQLT_RSET カーソルを表す OCI ステートメントリソースを生成します
SQLT_RDD ROWID オブジェクトを生成します
SQLT_BLOB LOB オブジェクトを生成します
SQLT_CLOB LOB オブジェクトを生成します
SQLT_BFILE LOB オブジェクトを生成します
SQLT_LNG SQLT_CHR としてバインドし、文字列として返します
SQLT_LBI SQLT_BIN としてバインドし、文字列として返します
Any other type SQLT_CHR としてバインドし、文字列として返します

目次



oci_bind_array_by_name" width="11" height="7"/> <overload
Last updated: Sun, 25 Nov 2007
 
add a note add a note User Contributed Notes
OCI8
anil dot samuel at gmail dot com
02-Jan-2008 10:00
ashnazg at php dot net
20-Dec-2007 03:51
Do not underestimate the importance of NLS_LANG in your environment.

The Oracle error "ORA-03106: fatal two-task communication protocol error" is indicative of not having NLS_LANG set.

In my case, I had a successfully processing INSERT statement followed by a failing SELECT statement that was resulting in that ORA-03106 error.  The successful INSERT implied that all Oracle environment settings were fine.  Ultimately we found that the NLS_LANG was not set, and I have to assume that only the SELECT of data back from the database actually _needed_ it, and therefore it was the SELECT statement that triggered the failure.  Though, that is all speculation.
christopher dot jones at oracle dot com
18-Jun-2007 01:25
There are several good books on PHP and Oracle available - search your favorite bookstore.  There is also a free book from Oracle "The Underground PHP and Oracle Manual" that covers the OCI8 extension: http://otn.oracle.com/tech/php/pdf/underground-php-oracle-manual.pdf
(free registration for OTN required, IIRC). Disclaimer: I'm one of its authors.
tuliogs at pgt dot mpt dot gov dot br
23-May-2007 12:12
Regarding issues with glibc "double free or corruption" or "free(): invalid next size" errors in error_log with PHP4 (PHP 4.4.7 is still afftected by this issue), and in addition to Rainer Klier´s notes below, if you´re using autoconf 2.5 (default on Redhat ES/CentOS 4.4 and 5, for example), you must delete PHP´s "configure" script before running "buildconf --force", or it will do nothing.

After that, you´ll need to use PHP 5 oci8 syntax with configure:
--oci8=instantclient,/path/to/instantclient

Only after this you´ll be able to compile PHP, but it´s a guaranteed fix - and, just to enforce Rainer´s point (as opposed to what has been said in other places), no need to rise memory limit and edit Makefile on x86-32. Good luck. ;)
david dot reynoldsat at ipl dot com
10-Apr-2007 11:56
I had a problem loading php_oci8.dll with php 5.2, Apache, and windows XP - a module not loaded error, on every apache restart.
I eventually found that I had to add the oracle instantclient library path to the %PATH% under SYSTEM and not under USER.  Doing that, and then rebooting, fixed the error - as Apache is starting as a service (outside the user setup).
James VL
01-Mar-2007 03:49
re: Andrei Kubar

I was using Oracle Instant Client on Windows XP, and was getting the

PHP Startup: Unable to load dynamic library 'C:\php\ext\php_oci8.dll' - The specified module could not be found.

error at startup, even though I had done all (most?) of the PHP and Oracle setup routines.

For me it wasn't the lack of mfc*.dll files, but a simple PATH issue: in addition to defining the environment variable TNS_ADMIN, I had to include my instant client directory in my PATH.
jay dot couture at gmail dot com
07-Dec-2006 08:26
# Here's what it took to get it going for me on Red Hat on
# x86_32 w/ 10gr2 and php5.1.2
# I sincerely appreciate all of the other poster's notes.
# It was a combination of a few
# of them to get mine configured. My note should reflect this:

# install the instantclient basic and sdk like this
# note: the original poster had you install into a lib subdirectory,
# but when I tried this it couldn't find the sdk files. So I moved
# the files in lib into the parent directory as
# shown below. Actually I copied them, YMMV
mkdir -p /usr/lib/oracle/10.2.0.2/client
unzip -jd /usr/lib/oracle/10.2.0.2/client
    instantclient-basic-linux-x86-32-10.2.0.2-20060331.zip
mkdir -p /usr/include/oracle/10.2.0.2/client
unzip -jd /usr/lib/oracle/10.2.0.2/client
    instantclient-sdk-linux-x86-32-10.2.0.2-20060331.zip
ln -s /usr/lib/oracle/10.2.0.2/client/libclntsh.so.10.1
    /usr/lib/oracle/10.2.0.2/client/libclntsh.so

# make the full client use instantclient's files
cd /app/oracle/product/10.2.0/db_1
mv lib oldlib
ln -s /usr/lib/oracle/10.2.0.2/client/lib lib
ln -s /usr/include/oracle/10.2.0.2/client include

#php configure line is:
    ./configure --with-oci8=instantclient,/usr/lib/oracle/10.2.0.2/client

# I had to do this, or the OCI8 would not compile when
# I ran make on PHP5.1.2 I did not do this originally when I
# had the files in the lib sudirectory (see my note above) so
# that may be the true issue.
export LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.2/client:$LD_LIBRARY_PATH

make

make install

#In apache2 edit the envvars and add
LD_LIBRARY_PATH="/usr/local/apache2/lib:
    /usr/lib/oracle/10.2.0.2/client:$LD_LIBRARY_PATH"
TNS_ADMIN="/usr/lib/oracle/10.2.0.2/client"
LANG=en_US
export LD_LIBRARY_PATH LANG TNS_ADMIN

#Restart Apache

Jay
Andrei Kubar
27-Nov-2006 12:53
If you try to use it with Oracle Instant Client 10.2.0.2 on Windows 2003 Server, you might be getting the

PHP Startup: Unable to load dynamic library 'C:\php\ext\php_oci8.dll' - The specified module could not be found.

error at startup, even though you had all done corresponding to PHP and Oracle setup routines.

reason for this may be the lack of

<b>mfc71.dll , msvcrt.dll and msvcr71.dll</b>

libraries on the system. Particularly the msvcr71.dll was the one which I missed and which caused the startup problem.

It is also a good idea to install the Patch 9 for the instant client (patch number 5604010 in metalink), it contains updated oci8.dll and oraociei10.dll versions.
private at private dot com
06-Jun-2006 01:59
To fsegtrop at estiem dot org:

Thank you for the note about the DOS/Unix line-endings.  My boss gave me his copy of tnsnames.ora from his Windows machine for my use on my Linux workstation.  I spent three hours trying to figure out why, and researching Oracle connections.

A simple dos2unix command on my tnsnames.ora file fixed the problem.
rainer dot klier at gmx dot at
22-May-2006 06:08
estoreic (note from 15-May-2006 10:54) is right.

there seems to be a problem with the oci8-api-functions in php 4.4.x.

there are error-messages like these in the error_log:
child pid 22297 exit signal Segmentation fault (11)
*** glibc detected *** double free or corruption (out): 0x00000000019f4730 ***
*** glibc detected *** double free or corruption (!prev): 0x0000000001111d90 ***
*** glibc detected *** corrupted double-linked list: 0x0000000001111d50 ***

using php 4.4.x with oracle 10.x is impossible, until you do the following:
1. download latest oci8-package from http://pecl.php.net/package/oci8
2. extract package somewhere
3. go to php-4.4.x-source directory
4. rm -rf ext/oci8
5. cp extraceted oci8-1.2.x directory to/as ext/oci8
6. make distclean
7. ./buildconf --force
8. ./.configure (with the options you need)
9. make
10. only for x86_64:
create pear-install.ini:
-----------------------------------------------
[PHP]

memory_limit = 128M      ; Maximum amount of memory a script may consume (8MB)
------------------------------------------------

11. edit Makefile:
replace:
PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0
with:
PEAR_INSTALL_FLAGS = -cpear-install.ini -dshort_open_tag=0 -dsafe_mode=0

12. make install

have fun!
oracle connections will work now!
estoreic dot list at gmail dot com
16-May-2006 02:54
We were having performance issues caused by Segmentation Faults on pages using Oracle.

An example of the Seg faults appearing in Apache's error log is:
*** glibc detected *** free(): invalid next size (fast): 0x0969ef30 ***
[Mon May 08 09:41:51 2006] [notice] child pid 3065 exit signal Aborted (6)

OR

[Mon May 08 09:48:58 2006] [notice] child pid 4747 exit signal Segmentation fault (11)

Our issue was due to a problem with OCI8 module in PHP (latest version 4.4.2).

Our solution involved recompiling PHP with the latest PECL OCI8 extension which can be downloaded from:
http://pecl.php.net/package/oci8

All segmentation faults and performance issues stopped once PHP was recompiled with OCI8 1.2.1.

If you are experience performance issues and/or seg faults I would recommend recompiling PHP with the latest stable OCI8 extension.
terry dot greenlaw at logicalshift dot com
13-May-2006 02:10
Dropping support for Oracle 9i clients on Windows is a huge mistake! Most people in production environments can't just slap another oracle_home on their box just for php traffic.

The Instant Client is aimed at desktop users, not servers, and is the last thing an experienced Oracle person would be installing.

The code works fine in 5.1.3RC2, so I guess we're stuck on that version until the issue is addressed properly.
jon at cssofla dot com
11-May-2006 01:48
For installation and enabling support of OCI8, I highly recommend Zend Core for Oracle from Zend.  I had almost a month's worth of trouble trying to get OCI8 working until I found that, and it was a piece of cake with that.
f dot kheiri at ucl dot ac dot uk
29-Apr-2006 11:40
To compile PHP 4.4.2 with OCI8 / Oracle 9i / AIX 5.2 (64-bit) / GCC

PHP will automatically compile against the Oracle 64-bit libraries, which PHP being a 32-bit app, will cause "make" to fail (though it will configure fine). Here's how to avoid this:

1. replace your PHP's ext/oci8 directory with the latest ext/oci8 directory downloadable from PECL - then remove the old directory entirely

2. rebuild configure by running:

./buildconf --force

...in PHP's root directory. This will rebuild the configure script.

3. using a tool like sed, in your configure file replace all instances of /path/to/oracle/lib with /path/to/oracle/lib32 - note, this may require GNU's autoconf, m4 and gnumake.

4. export LD_LIBRARY_PATH=/path/to/oracle/lib32

5. ./configure --with-oci-8=/path/to/oracle (and any other options)

Then, the usual make and make install.
26-Apr-2006 07:29
# here's what it took to get it going for me on rhel4 on x86_64 w/ 10gr2 and php5.0.5
# hopefully this will save someone a little grief
# first you must install the 10.2 full client in /app/oracle/product/10.2.0/db_1
# follow all the instructions. This part will be a bitch.

# install the instantclient basic and sdk like this
mkdir -p /usr/lib/oracle/10.2.0.2/client/lib
unzip -jd /usr/lib/oracle/10.2.0.2/client/lib instantclient-basic-linux-x86-64-10.2.0.2-20060228.zip
mkdir -p /usr/include/oracle/10.2.0.2/client
unzip -jd /usr/lib/oracle/10.2.0.2/client instantclient-sdk-linux-x86-64-10.2.0.2-20060228.zip
ln -s /usr/lib/oracle/10.2.0.2/client/lib/libclntsh.so.10.1 /usr/lib/oracle/10.2.0.2/client/lib/libclntsh.so

# make the full client use instantclient's files
cd /app/oracle/product/10.2.0/db_1
mv lib oldlib
ln -s /usr/lib/oracle/10.2.0.2/client/lib lib
ln -s /usr/include/oracle/10.2.0.2/client include

php configure line is: --with-oci8=/app/oracle/product/10.2.0/db_1/
jdstil at nononsense dot bluewin dot ch
19-Mar-2006 08:02
Apache 1.3, Oracle 9.2, PHP 5.1.2 on Windows XP Pro.
Very weird behavior with php_oci8.dll coming with the full windows build (I downloaded yesterday...). Couldn't get any of the examples to work, it appears Apache crashes on oci_parse, but not so if I program "C style":

  while this doesn't work:
    <?php
      $db_conn
= oci_connect("scott","tiger");
     
$parsed = oci_parse($db_conn,"select * from emp"); <-- Apache crashes on execution of this statement
     
// etc...
   
?>

  this does:
    <?php

     
function main($connection)
      {
       
$parsed = oci_parse($connection,"select * from emp");
       
$r = oci_execute($parsed, OCI_DEFAULT);
       
// etc...
     
}

     
$db_conn = oci_connect("scott","tiger");

     
main($db_conn);

     
oci_close($db_conn);
   
?>

Took me the whole day, then I found Francesco Marsan's note (THANKS!) dated February 9th, 2006... and indeed, downloading from http://pecl4win.php.net/ext.php/php_oci8.dll solved the problem instantly.
soef at tjah dot net
04-Mar-2006 05:04
To install this in gentoo linux you will need to do some weird stuff:

-  Make sure you have this use flags set: "dba cli pcre xml zlib oci8-instant-client"
- Unmask PHP (5.1.1) by placing "dev-lang/php ~x86" in /etc/portage/package.keywords
- Unmask oracle-instantclient-basic (10.2.0.1-r1) by placing "dev-db/oracle-instantclient-basic ~x86"
- Download oracle files from "http://otn.oracle.com/software/tech/ oci/instantclient/htdocs/linuxsoft.html" (You have to make an account and login, in order to download the packages:

    * instantclient-basic-linux32-10.2.0.1-20050713.zip
    * instantclient-sdk-linux32-10.2.0.1-20050713.zip

- Place the downloaded packages in "/usr/portage/distfiles"
- "emerge apache dev-lang/php5" (If you done right, the build for the instantclient will be selected automaticly.
- Configure your "/etc/conf.d/apache2" to make sure you have "-D PHP5" in your "APACHE_OPTS"
dfischer at qualcomm dot com
03-Mar-2006 10:00
Here are some tips on getting the instant client to work with php:

I am using Fedora Core 3 and php-5.1.2 on x86.

Install:
oracle-instantclient-basic-10.xxxx.i386.rpm
oracle-instantclient-devel-10.xxxx.i386.rpm

Configuring php:
./configure --with-oci8=instantclient,/usr/lib/oracle/10.xxx/client/lib/
This path will change if you unzip it isntead of using the rpms. Make sure it points to where libclntsh.so is installed.

Configuring apache:
The following lines need to be in your .../apache/bin/envvars file:
LD_LIBRARY_PATH="/usr/lib/oracle/10.xxx/client/lib/: /opt/apache2/lib:$LD_LIBRARY_PATH"
TNS_ADMIN="/usr/lib/oracle/10.1.0.4/client/lib/"
LANG=en_US
export LD_LIBRARY_PATH LANG TNS_ADMIN
You will need to modify the paths to the oracle instantclient libs and to apache. In addition, the language will need to be modified if not US English.

TNS Names and Oracle:
Put the tnsnames.ora and sqlnet.ora files into the same directory as libclntsh.so.

Restart apache and you should be able to connect.
jnavratil at houston dot rr dot com
13-Feb-2006 10:30
The error message "There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory" is somewhat deceptive in that it can be emitted even when ORACLE_HOME is correctly set, but that there is a connection failure when the OCI8 extension uses the Oracle OCI API.  This API requires access to several files in the Oracle distribution which, at least in the 10g release 2 distribution, are not available to 'others'.  It seems this may be the reason that we are directed to give oracle 'oinstall' group access to the apache user.  For those who do not consider this a good idea, the solution is to grant 'other' access to the files.

I used the following script (YMMV) ....

export ORACLE_HOME=<your-Oracle-home-here>
chmod o=x $ORACLE_HOME/network
chmod o=x $ORACLE_HOME/network/admin
chmod o=r $ORACLE_HOME/network/admin/tnsnames.ora
chmod o=r $ORACLE_HOME/nls
chmod o=r $ORACLE_HOME/nls/data
chmod o=r $ORACLE_HOME/nls/data/*
chmod o=x $ORACLE_HOME/oracore
chmod o=x $ORACLE_HOME/oracore/zoneinfo
chmod o=r $ORACLE_HOME/oracore/zoneinfo/timezlrg.dat
chmod o=r $ORACLE_HOME/rdbms
chmod o=r $ORACLE_HOME/rdbms/mesg
chmod o=r $ORACLE_HOME/rdbms/mesg/*

The ORACLE_HOME environment variable *IS* required, but I found no need to set the others (again, YMMV).

To discover the files referenced by your OCI8 scripts, you can open the security by giving apache group access to the Oracle directories, touching some temp file and using 'find' to discover the files which have been accessed.  Try using...

cd $ORACLE_HOME
find . -anewer <my-touched-temp-file> -print
francesco [dot] marsan [at] yahoo.it
10-Feb-2006 06:47
If you experience Apache crashes on a Windows platform with PHP 5.1.2 while trying to access Oracle, try exchanging the php_oci8.dll that comes with the distribution, with the one that is on http://pecl4win.php.net/ext.php/php_oci8.dll. After much trouble while trying many install options this finally solved my issues and worked fine.
cjbj at hotmail dot com
20-Jan-2006 01:09
PHP 5.1.2 was the first PHP release to ship the "re-factored" OCI8 1.1 driver.

The configuration options for the re-factored driver have changed, particularly for building with Oracle Instant Client. Some older articles and documentation are now obsolete.   Run ./configure --help to see the new syntax.

User's of PHP prior to 5.1.2 can install the re-factored driver from http://pecl.php.net/package/oci8 or http://pecl4win.php.net/ext.php/php_oci8.dll
wes9999 at myfastmail dot com
19-Jan-2006 02:19
If you're compiling php 5.1.2, and using the oracle instant client, the appropriate configure option is:
--with-oci8=instantclient,/path/to/instantclient/libs

which is a change from the configure option for php 5.1.1, which was:
--with-oci8-instant-client=/path/to/instantclient/libs

If you use the old one with php 5.1.2, it just silently ignores this option and the resulting php build doesn't have oracle support.
scoop at subindie dot com
27-Oct-2005 05:27
Regarding compiling with the recently updated OCI8 Extension (http://pecl.php.net/package/oci8).

I ran into problems when statically compiling, such as numerous "undefined reference to `zif_oci_***'" errors.  Since I likely won't be the only one to run into this problem, here's some helpful hints:

If you've previously compiled your php installation, first: make clean

Then replace the existing php-x.x.x/ext/oci8 directory with the latest package from: http://pecl.php.net/package/oci8

./buildconf --force
./config ..
make
jistanidiot at gmail dot com
17-Sep-2005 12:07
On RHEL for PHP4 or 5...

For Oracle 9i before you compile PHP but after you install Oracle, you need to make the following symlinks:

ln -s $ORACLE_HOME/rdbms/public/nzerror.h  $ORACLE_HOME/rdbms/demo/nzerror.h

ln -s $ORACLE_HOME/rdbms/public/nzt.h $ORACLE_HOME/rdbms/demo/nzt.h

ln -s $ORACLE_HOME/rdbms/public/ociextp.h $ORACLE_HOME/rdbms/demo/ociextp.h

ln -s $ORACLE_HOME/lib/libclntsh.so.9.0 $ORACLE_HOME/lib/libclntsh.so.8.0

ln -s $ORACLE_HOME/oui/bin/linux/libcdlntsh.so.9.0
$ORACLE_HOME/oui/bin/linux/libcdlntsh.so.8.0

With 10g you need to make the first three and then this one:
ln -s $ORACLE_HOME/lib/libclntsh.so.10.0 $ORACLE_HOME/lib/libclntsh.so.8.0
denis dot delamarre at chu-rennes dot fr
10-Jun-2005 02:00
php5 + Apache 2 + solaris 2.10 + oracle9i (64bits)

'./configure' '--with-oracle=/prod/dba/oraeve/ora9i' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-zlib' '--with-gd' '--without-mysql' '--with-oci8=/prod/dba/oraeve/ora9i'

fail with :
ld: fatal : fichier libclntsh.so : wrong elf class : ELFCLASS64

the solution is between ./configure and make command to edit Makefile and replace /ora9i/lib  with  /ora9i/lib32

all it's ok
MSapp
07-Jun-2005 10:48
Problems compiling 5.0.4 with Oracle Instant Client 10? (i.e. cannot find -lirc)

Remove the "-lirc" from sdk/demo/sysliblist and rerun configure.
darkstar_ae at hotmail dot com
26-Apr-2005 02:39
When fetching associative arrays, use uppercase string indices. It appears the PHP OCI Library is less lenient with the field names returned by Oracle.

e.g.

echo $row['field1']; // This won't return anything.

as opposed to:

echo $row['FIELD1'];
kucerar at hhmi dot org
24-Feb-2005 01:29
Great Solaris patch!  Finally built.  Here's some tips on connecting:

Just made this on solaris8 32bit, actually works.

1) put everything in one directory
2) unsetenv ORACLE_HOME
3) set the env vars LD_LIBRARY_PATH and SQLPATH and TNS_ADMIN(if you have it) to that directory.
4) use one of the other easy connection notations here

http://www.oracle.com/technology/
docs/tech/sql_plus/10102/readme_ic.htm

These env vars worked when put at the top of apachectl script as well.

To build you may have to fake it out with an ORACLE_HOME var,  but unset it later.  You may also have to fake out the build by putting header files where it is looking for them,  e.g. in the rdbms/demo directory or some such other place.

When running though,  make sure you have only the files required in only one directory.

Oracle has not put up a link to the 32bit solaris sqlplus--you have to guess it--it's there though:

http://download.oracle.com/otn/solaris/instantclient/
instantclient-sqlplus-solaris32-10.1.0.3.zip
 
...and don't forget to add ".world" on to the end of your SID. It's very common to have to specify DBNAME.WORLD to connect.
buswash at gmail dot com
02-Feb-2005 11:51
PHP 5.0.3 + Solaris 9 (UltraSPARC) + Apache 2.0.51 + Oracle 10g Instant Client 10.1.0.3

Thanks to Jakob's patch I got this combination working.  Here are some things that helped me:

1. After getting this:
ld: fatal: file /opt/oracle/instantclient/libclntsh.so: wrong ELF class: ELFCLASS64

I realized that PHP is a 32-bit application and that all 3rd-party libraries need to be 32-bit as well.  You need to download the 32-bit version of Instant Client (basic + sdk), even if you are running the 64-bit Solaris OS.

2. My patch command syntax was a little different:
patch -p0 -i php5_ociclient.patch config.m4

Thanks again to Jakob for porting the patch over to PHP 5.

Marc
jakob dot jellbauer at interhyp dot de
19-Jan-2005 05:00
Yes, i`ve made it !
Installing PHP 5.0.3 and the Oracle 10g Instant Client on Linux .

There is no need to have a full Oracle Installation on the Webserver, you only need the client.

http://www.oracle.com/technology/pub/notes/technote_php_instant.html

The patches provided from Oracle are for PHP Versions 4.3.9 or 4.3.10.

Here is the handmade patch for PHP 5.0.3 :

...
patch -u php-5.0.3/ext/oci8/config.m4 php5_ociclient.patch
cd php-5.0.3
rm -rf autom4te.cache config.cache
./buildconf --force
...

Download the Patch here:

 http://www.pubanz.de/jakob/php5_ociclient.zip

Have fun,

Feel free to ask me if there are any questions
mark at magpies dot net
06-Jan-2005 06:05
Hello once again.
This time I present details on how to get Oracle Instant Client 10g ( 10.1.0.3 ), PHP 5.0.3 and Apache 2.0.52 running together on Linux (I've used fedora core 1 but I can't see why this will not work for any other distro )
*Note* This is not a guide on compiling php and httpd there are plenty of guides around to do that. This just covers compiling and using the oci8 module with php.

1. Set-up and install apache-2.0.52 as per normal

2. Unpack the Oracle 10g Instant Client ( 10.1.0.3 SDK + Basic, I also use the sqlplus pack to test the connection outside of apache / php )
  rpm -ivh oracle-instantclient-basic-10.1.0.3-1.i386.rpm  oracle-instantclient-devel-10.1.0.3-1.i386.rpm  oracle-instantclient-sqlplus-10.1.0.3-1.i386.rpm

3. Set env ORACLE_HOME to the clients path in the current shell your shell command may vary (this is bash )
  export ORACLE_HOME=/usr/lib/oracle/10.1.0.3/client; export LD_LIBRARY_PATH=/usr/lib/oracle/10.1.0.3/client/lib;
(if you want to test if you can now get a connection to oracle using sqlplus see item 10 below.)

4. Unpack php-5.0.3 as per normal add in  --with-oci8  to the configure options. If the ORACLE_HOME is set previously then adding the directory as per "--with-oci8=$ORACLE_HOME" should not be necessary. Do this to be safe though.

5. Run the ./configure program in php source directory. Don't make it just yet though.

6. The compiler needs to find the includes oci.h + others so, from the default client install dirs, I needed to edit the php Makefile after it was configured. Open it up and look for "EXTRA_INCLUDES" and add to end of line
-I/usr/include/oracle/10.1.0.3/client  (thats a capital i ) save the Makefile, then finish off compiling and installing php.  Please note im sure this will be changed in php's configure so it finds these by default in the not too distant future.

7. Create a directory /etc/oracle and place your tnsnames.ora file in there, (VERY IMPORTANT make sure you chmod your tnsnames.ora to ensure that whatever username your httpd server runs under can read the file (1.5 hours of frustration later i figured this out). I just did "chmod 0644 tnsnames.ora" it doesn't matter where you put this as long as you set the env  TNS_ADMIN to it. (IMPORTANT  TNS_ADMIN points to a directory not the actual tnsnames.ora file )

8. My system uses a /etc/init.d/httpd script to start up httpd so in that file I exported the ORACLE_HOME & TNS_ADMIN env vars before the httpd is run, oh you will need to set LD_LIBRARY_PATH as well if you not added the path to ld.so.conf
  export ORACLE_HOME=/usr/lib/oracle/10.1.0.3/client; export TNS_ADMIN=/etc/oracle
 
9. start httpd and bobs your uncle....

10. You can test connection once the instant client rpm's are installed by using   sqlplus.   set  ORACLE_HOME as above,  TNS_ADMIN as above, LD_LIBRARY_PATH as above and if necessary.  Then  sqlplus <username>/<password>@<sid or service_name as per tns_admin file>  use sqlplus here as you would normally

Mark
PS: Thanks Oracle for the SDK,  about time !
Mark at catalyst dot net dot nzed
10-Aug-2004 12:28
ReCompiling PHP4 to have oracle 8 support (oci8) on Debian Linux, using the Oracle 10g client libraries. Log in as root.

PACKAGES REQUIRED:
php4-dev
php4 (source files)
php4 module (might not be required, but it's what i had installed at the time)

OTHER PACKAGE REQUIREMENTS:
Oracle Client Libraries (i used Oracle 10g Server, but you should be able to use, as has been previously said, any set of the oracle client libraries from 8i onwards).
* make sure this is installed before recompiling php4.

ENVIRONMENT REQUIREMENTS:
- export ORACLE_HOME=[where u installed the oracle client]
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
- export LD_PRELOAD=libclntsh.so.10.1 (the version number at the end will correspond to the oracle version you previously installed. in my case, 10g is 10.1).
- vi /etc/ld.so.conf and add $ORACLE_HOME/lib to the list of paths.
then * run ldconfig to reload those changes to the system * (p.s. make sure it's the full path, and not using any environment variables. e.g. /u01/app/oracle/product/10gRDBMS is my ORACLE_HOME).

STEPS:
- cd /usr/src/[PHP4 Version]
in my case, [PHP4 Version] = php4-4.3.8, so path was
/usr/src/php4-4.3.8

- vi debian/rules
these are the default compilation rules for php4. Find section labeled COMMON_CONFIG = [...] and add --with-oci8 (it should be near the top of the file).

- debchange -i (allows you to edit the change log for the versions of php. btw - you should be in the php4 source code directory). give the version id something obviously unique. don't forget to add a comment.

when all is in readyness, then you should be able to go debian/rules binary to build the debian packages required.
the deb packages are built into the /usr/src directory. and depending on the default compilation options u choose, there should be a few. find the deb package that corresponds to the main php4 module (php4_4.3.8-4.mark.1_i386.deb for me), and run dpkg -i [package name] to install it.

- vi /etc/init.d/apache and add exports for $ORACLE_HOME, $LD_PRELOAD and $LD_LIBRARY_PATH

* don't forget to restart apache /etc/init.d/apache to reload the php4 module. *

IF YOU GET... :
if you get an error saying something about apache cannot load libclntsh.so.10.1, file not found, check the environment variables, for both the user, and in /etc/init.d/apache and also check ld.so.conf to make sure the $ORACLE_HOME/lib path is in there, and has been reloaded (with ldconfig).

editing ld.so.conf was the part that finally got it working for me.
as you should be able to tell, the steps are pretty much the same as for all oracle versions 8i onwards, and all linux OS's. but with a few debian specific paths and commands thrown in.
mark at magpies dot net
06-Jul-2004 01:07
For those trying to use the Oracle Instant Client 10g in a win32 environment, heres a nice easy howto. If you fully read the docs properly and understand what your reading you will be able to set it up, but if like me you want a quick easy fix, heres how I did it.

1. Download and install the Oracle Instant Client to where ever (lets say  c:\ora\client  )
2. Add your connect info, copy a previously created or provided tnsnames.ora file to the above directory.
3. Change Path in the Environment Variables area to add this directory to the path. ie.  c:\ora\client;%SystemRoot%;<and so on>
4. Open regedit and add a Key called ORACLE to HKEY_LOCAL_MACHINE\SOFTWARE
5. To the ORACLE key add a string value called TNS_ADMIN and assign it the directory above (ie. c:\ora\client )  So you end up with KEY_LOCAL_MACHINE\SOFTWARE\ORACLE\TNS_ADMIN = c:\ora\client
6. Set php to use Oci8 extension and bobs your uncle
7. Reboot.

Option 7 was required as the oci8 extension or php wouldn't pick up the path change. Also my problem was how to use other programs like sqlplus without creating extra Environment Variables etc the TNS_ADMIN / tnsnames.ora part makes that simpler and allows you to call things the same as you would before.

PS: This should apply to all the Instant Clients. I haven't tried it with any others but 10g though.

Hope this helps.
beckman at purplecow dot com
15-Jun-2004 08:20
For those of you running Oracle on Linux, and running a remote box also on Linux, here's an easy way to get OCI8 working without having to install the whole Oracle DB just to get your client working.

[PS -- For the life of me, installing client libraries for Oracle really shouldn't be this hard, but it really truly is.]

Step 1.  Copy the following directories from your ORACLE_HOME directory where Oracle is installed (the database server) to your remote client server/machine:

     lib, network, ocommon, plsql, rdbms, oracore

   These contain all of the files/folders/libraries you'll need to compile OCI8 into PHP.  I put this in /home/beckman/oracle and set ORACLE_HOME as that dir.

Step 2.  Compile PHP with --with-oci8=/home/beckman/oracle (obviously using your directory, not mine).  Install, (re)start apache.

Step 3. Remove plsql and rdbms directories from ORACLE_HOME on your remote server, leaving you with lib, network, ocommon and oracore.

Step 4. Read: http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html

NOTE: This will only help you if you (a) have Oracle successfully running on Linux (was RH Enterprise 3 for me) and your client box is running the same OS.  I'm not sure it will work on earlier versions, but it may.  Your results should be posted here methinks!
cyrill@_malevanov_dot_spb_dot_ru
11-May-2004 05:05
Passing CLOB to stored procedure and retrieve CLOB too (function lobinout(a in clob) return clob)

<?
    error_reporting
(1+2+4+8);
   
$conn = OCILogon('batdtd', 'batdtd', 'batxml');
   
   
$lobin = OCINewDescriptor($conn, OCI_D_LOB);
   
$lobout = OCINewDescriptor($conn, OCI_D_LOB);
   
   
$stmt = OCIParse($conn, "declare rs clob; begin :rs := lobinout(:par); end;");
   
$lob_data = 'abcdefgh';
   
    echo
"binding lobin...";
   
OCIBindByName($stmt, ':par', $lobin, -1, OCI_B_CLOB);
   
    echo
"done<br>binding rs...";
   
   
OCIBindByName($stmt, ':rs', $lobout, -1, OCI_B_CLOB);
   
    echo
"done<br>writing temp lob...";
            
// here we pass data to func
   
$lobin -> WriteTemporary($lob_data);
    echo
"done<br>executing...";
   
   
OCIExecute($stmt, OCI_DEFAULT);
            
// here we load data returned from func
   
echo "done<br>rs = ".$lobout->load();
   
OCICommit($conn);
   
$lobin -> free();
   
$lobout -> free();
   
OCIFreeStatement($stmt);
   
OCILogoff($conn);
?>
dadarden_nospamoladude at iti2 dot net
13-Mar-2004 10:27
PHP Oracle -- Compiling Oracle Support into PHP, Apache 2
Apache 2.0.48,   Php 4.3.4,  Red Hat Linux 9.0,  Debian 3.0,  Oracle 9i R2
Dave Darden � 1/17/04 -- www.dardensystems.com

First install Apache 2 from source.  Instructions are at http://httpd.apache.org/docs-2.0/install.html. 
I used a --prefix=/usr/local/apache on the install. 

Install Oracle.  There is a very good Oracle install to RedHat 9.0 white paper at http://www.dizwell.com/ that goes step by step through the problems (Oracle is not supported on RedHat 9.  Oracle only supports installation on paid versions of Red Hat). 

If only an Oracle client is installed on the web server (if the database is on another machine in a multi-tier configuration) then you must install both the client and the Oracle Call Interface (OCI).  I think SQLPlus also needs to be installed.  Oracle Network Utilities and Installation Common Files were also installed.  If you cannot configure/make php because of missing Oracle library errors during configure/make, then investigate whether you have installed enough of the �client� pieces of Oracle on the web server machine. 

I also included a link from   libclntsh.so.8.0   to   libclntsh.so.9.0   in the $ORACLE_HOME/lib directory.   Some internet posts suggested it to prevent errors in php configure/make.   A later experience moving from RedHat to Debian confirms that it is necessary to avoid a make error on a missing lclntsh file. 

In transferring the client software from a Red Hat 9.0 web server installation to a Debian 3.0 (kernel 2.4.18) web server installation I was able to simply copy over the Oracle /u01 directory tree without rerunning the Oracle client installation.   This must be done before php is configured and compiled on the Debian machine so the oci8 libraries are available.   And of course the tips on libclntsh and environment variables must be observed as well. 

Get the php source.  This php configure line worked for me, creating an Apache 2 module, and keeping mysql and gd support.  Add other options if you need them for a given site.  For some reason, even though gd is included with php now, zlib was needed to successfully configure and make php from source when including gd.   You will need to substitute appropriate directory locations for your install of Apache, zlib, and Oracle.

./configure --with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql --with-gd \
--with-zlib-dir=/usr/local \
--with-config-file-path=/etc \
--enable-force-cgi-redirect --disable-cgi \
--with-oci8=/u01/app/oracle/9i --enable-sigchild

Use an absolute path on   -�with-oci8=/u01/app/oracle/9i 
(Do not use the $ORACLE_HOME path variable in the configure statement.  For some reason it does not work even when it is set properly.)

Also, set the environment variables in
/usr/local/apache/bin/envvars like so (your env var values should vary):

export ORACLE_SID="lx92"
export ORACLE_HOME="/u01/app/oracle/9i"
export TNS_ADMIN="/u01/app/oracle/9i/network/admin"
export LD_LIBRARY_PATH="/u01/app/oracle/9i/lib"
export TNS_ADMIN="/u01/app/oracle/9i/network/admin/tnsnames.ora"
export TWO_TASK="/u01/app/oracle/9i/network/admin/tnsnames.ora"
export NLS_LANG="English_America.WE8ISO8859P1"
export ORACLE_BASE="/u01/app/oracle"
oddbec_no_more_spam_kthx at online dot no
25-Feb-2004 01:49
I had trouble with norwegian characters using oracle 8.7.1 / php 4something and Apache 2.

The only trouble was that '?' appeared instead of the norwegian characters.

The solution to it all was to add this to the apachectl script:

export NLS_LANG="norwegian_norway.WE8ISO8859P1"
export ORACLE_BASE="/home/oracle"
export ORA_NLS33="/home/oracle/ocommon/nls/admin/data"
export ORACLE_TERM="ansi"
export ORACLE_HOME="/home/oracle"
export LANG="no_NO"

I'm not sure if all of these are necessary, but I took no change, and it works now :)
lomax at arizona edu
26-Jul-2003 08:26
Can't compile php with Oracle 9i and apache on Solaris8?
Sun 280R

Using some of the tips below I had to add this:
(static build)

#!/bin/tcsh
setenv LDFLAGS -L$ORACLE_HOME/lib32

cd php-4.x.x/
./configure --with-oci8=$ORACLE_HOME --with-apache=/path/to/apache_src ..etc
make
make intsall

cd apache_src
(make sure environment variable is still set)
./configure  "--prefix=/usr/apache" "--enable-module=so" \
"--activate-module=src/modules/php4/libphp4.a"  ...etc
make
make install

Having the gcc compilier build php against oracle 32 bit libraries was the key, but without setting LDFLAGS the compiler defaults to using the 64-bit oracle libraries which cause the famous
"...wrong ELF class: ELFCLASS64.." on startup.

The only diffenece here was I didn't have to do play musical directories for it to work. The below post was instrumental in helping me to get this fixed. Thanks to "lore_giver at lycos dot co dot uk"
lore_giver at lycos dot co dot uk
21-May-2003 03:42
Running Oracle 9i on a
Solaris 9 (64 bit) platform with a Sun Server E250:
Apache version 1.3.27
PHP version 4.3.1

I was first getting "...wrong ELF class: ELFCLASS64.."
while doing a ./configure with the --with-oci8 and --with-oracle parameters.

After some unsuccessfull searched I renamed the $ORACLE_HOME/lib to $ORACLE_HOME/lib.org and then renamed the
$ORACLE_HOME/lib32 to $ORACLE_HOME/lib

Thereafter it went passed this config, but now failed on
not being able to find a libwtc9.so file which was in the
$ORACLE_HOME/lib directory  (this message was displayed in the debug.log in the php source directory).

After setting the Environment variable:
LD_LIBRARY_PATH=$ORACLE_HOME/lib
I was able to compile without any errors and 'make' and 'make install' ran smoothly.

I only had to add the php type in the httpd.conf (in your apache conf directory eg. /usr/local/apache/conf)..
AddType application/x-httpd-php .php
to get the php to work again...

I had to then reverse the $ORACLE_HOME/lib swop on top since php was now having problems with the 32 bit version of the library...so switched it back to 64 and my php script worked....

Hope this helps some out there with similar problems..

Cheers
10-Dec-2002 06:53
Configuring/Compiling PHP as a DSO with Oracle support from source on a Sun Solaris 8 box.  We had already installed Oracle 9.2.0 client tools.

1. Make sure the following tools are installed

    autoconf
    automake
    bison
    flex
    gcc
    make
    gzip
   
    They can be downloaded from http://www.sunfreeware.com.
   
2.  Make sure Apache is installed with DSO support.  We ran the Apache configure/compile like so:

    LIBS=-lpthread ./configure \
    --prefix=/usr/local/apache \
    --enable-module=most \
    --enable-shared=max
   
   
    make
    make install
   
3.  If you haven't already, install the Oracle client tools.
4.  Make sure the following environment variables are set correctly and are accessible by all users.  We set them in /etc/profile.

    ORACLE_HOME
    ORACLE_BASE
    NLS_LANG
    ORA_NLS33
    ORACLE_TERM
    LD_LIBRARY_PATH
   
    (technically, only $ORACLE_HOME is required, but you'll want to set the rest in order to make sure things run smoothly afterward)
   
5.  Make sure '/usr/ccs/bin' is in your path.  If not, add it.
6.  Unpack PHP source (php-4.2.3):

    gunzip php-4.2.3.tar.gz
    tar xvf php-4.2.3.tar
    cd php-4.2.3

   
7.  Run PHP configure like so :

    CC=gcc ./configure --with-apxs=/usr/local/apache/bin/apxs \
    --with-config-file-path=/etc \
    --with-mysql \
    --enable-ftp \
    --with-oci8=/path/to/ORACLE_HOME \
    --with-oracle=/path/to/ORACLE_HOME \
    --enable-sigchild
   
8.  Run make:  make
9.  Run this as root:  make install
10.  Change the LoadModule line in httpd.conf to include the fully qualified path.  For us:

    LoadModule php4_module        /usr/local/apache/libexec/libphp4.so
   
11.  Make sure the PHP files types are recognized in your httpd.conf file:

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
   
12.  Test the configuration:

    /usr/local/apache/bin/apachectl configtest
   
    It should return "Syntax OK"
   
13.  Bounce Apache:

    /usr/local/apache/bin/apachectl restart
   
   
14.  Here's a simple PHP script to test the setup.  If you don't have access to the default tables Oracle provides, change the connections/tablenames/fields to match your setup:

    <?php

    $db_conn
= ocilogon("scott", "tiger");

   
$cmdstr = "select ename, sal from emp";
   
$parsed = ociparse($db_conn, $cmdstr);
   
ociexecute($parsed);
   
$nrows = ocifetchstatement($parsed, $results);
    echo
"Found: $nrows results<br><br>\n";

    echo
"<table border=1 cellspacing='0' width='50%'>\n";
    echo
"<tr>\n";
    echo
"<td><b>Name</b></td>\n";
    echo
"<td><b>Salary</b></td>\n";
    echo
"</tr>\n";

    for (
$i = 0; $i < $nrows; $i++ ) {
          echo
"<tr>\n";
          echo
"<td>" . $results["ENAME"][$i] . "</td>";
          echo
"<td>$ " . number_format($results["SAL"][$i], 2). "</td>";
          echo
"</tr>\n";
    }

    echo
"</table>\n";

   
?>
poulman at uponorhsdna dot com
11-Oct-2002 03:51
Re: ora-12154 errors with PHP 4.2.3, Apache 1.3.27, and Oracle 9i (client only) I had two identical set ups, one on SuSE 8.0 and one on RedHat 8.0, the SuSE worked and RedHat errored with ora-12154! For some reason, having the apache user in the oracle group worked for SuSE but did not for RedHat, I had to run the Apache service as oracle user (the one used to install oracle client). Just wanted to share this little tidbit with anyone who might be pulling their hair out like me :-). Other key things were setting the ORACLE_HOME env variable before starting Apache (I did this in the profile file).
bradburn at kiwi dot de
24-Sep-2002 09:23
keywords: NLS_LANG, NLS_CHARACTERSET,SetEnv,putenv()

If you have tried setting the environment variables -- especially NLS_LANG -- in PHP with putenv(), and perhaps also in Apache with SetEnv, and you are still having trouble with PHP+Oracle and foriegn character sets (you get e.g. 'd' for '�'), try setting the environment variables in your PROFILE (e.g. under bash) BEFORE starting the Apache server once more. This finally stopped the problems we were having. For reference, set the following variables:

ORACLE_HOME
ORA_NLS33
TNS_ADMIN
TWO_TASK
CLASSPATH
LD_LIBRARY_PATH
NLS_LANG

An example would be:

NLS_LANG=GERMAN_GERMANY.WE8ISO8859P15; export NLS_LANG

Then restart Apache (see below for important note).

Our system was Sun SPARC 5.8, running Apache 1.3.26 with PHP 4.2.2, and the OCI8 API for Oracle.

One further note: restart Apache with:

  apachectl stop
  apachectl start

rather than

  apachectl restart

otherwise your environment may not be reset.

Hope this helps someone!

Ed
s917725 at mail dot yzu dot edu dot tw
18-Sep-2002 11:11
If you still have ORA-12154 failed with Apache PHP on oracle8i
check
1.edit httpd.conf the apache starter user should the same user(and group) who install oracle(oracle:oinstall)

2.make apache starter .bash_profile the same with user who install oracle
3.and restart apache and php
4.make sure
$c2 = ocilogon("scott","tiger",$db);

the $db should the same with /etc/oratab  SID

taht's all
devolver at iastate dot edu
31-May-2002 08:32
I spent several hours tracking down error ORA 24374, which would result from only *SOME* of my select statements.  This error would be caused if I made a query that would return any non-numerical value.  I am running an Apache 1.3.x webserver and PHP 4.2.1.

The fix is to add entries in your httpd.conf file that would export your environment settings.  I added these three lines and everything worked like a charm!
SetEnv ORACLE_HOME  /path/to/oracle/home
SetEnv ORA_NLS33  /path/to/oracle/home/ocommon/nls/admin/data
SetEnv NLS_LANG AMERICAN

Obviously, if your NLS_LANG is different, you should set it to whatever your NLS_LANG actually is.  Ask your friendly DB admin for this information.

Hope this helps someone who treads down the path that I just followed!

Trent
ddc at portalframework.com
15-May-2002 03:30
Sometimes Oracle doesn't cleanup shadow processes when accessed from PHP. To avoid that, check your
$ORACLE_HOME/network/admin/tnsnames.ora file in your Oracle Client directory and remove the (SERVER=DEDICATED) token if is set.

To let Oracle delete shadow process on timeouts, add the following line in your $ORACLE_HOME/network/admin/sqlnet.ora
found in your ORACLE Server directory:

SQLNET.EXPIRE_TIME=n

Where 'n' is the number of minutes to let connection idle befor shutting them out.
morales at tj dot rs dot gov dot br
25-Apr-2002 09:33
Debian / Apache / PHP oci8 / Oracle

I just wanna tell my experience compiling the oci8 support from php debian sources. It gave me a lot of headache and I think it might be useful for others who use debian.

This is for debian woody (3.0), php 4.1.2, apache 1.3.24, oracle 8.1.7
(of course, it might be useful for other versions)

The Debian packages have not oci8 compiled in, so you must get the sources. Then I edited the debian/rules file and added the following:

on top:

ORACLE_HOME=my_ora_home_here
export ORACLE_HOME
LD_LIBRARY_PATH=/lib:/usr/lib:/$ORACLE_HOME/lib
export LD_LIBRARY_PATH

to the COMMON_CONFIG variable:
--with-oci8=shared,${ORACLE_HOME}

to the modules variable, just bellow the above:
oci8
(like ... mhash, mysql, oci8, odbc ...)

The "shared" keyword was the key for me. Before using it I was getting "ld: cannot find -lclntsh" on the compile time.

This way the compiling with dpkg-buildpackage went fine. If oci8.so does not show up in the modules directory after install, look php-source-path/apache-build/ext/oci8/.libs - it's there.

If this still fails, look also to the oracle-stubs problem. Oracle is compiled against glibc 2.1 and woody comes with 2.2. But oracle gives some stubs libs for work-around the problem. I don't know if this is necessary for the client libs, but I suggest trying. Look at Oracle docs.

Now things goes terribly fine here.
[]'s

Diego Morales,
Porto Alegre - Brazil.
edahnke at consultant dot com
09-Jan-2002 05:01
Here's a little snipet that shows how to insert multiple clob fields. Worked for me.

$dbh = OCILogon($dst_user_name, $dst_password, $dst_db_name);

for($i = 0; $i < $src_rec_cnt; $i++) {
    $query = "insert into bid (id,time,resume,experience,comments) values ('$id[$i]','$time[$i]',empty_clob(),empty_clob(),empty_clob()) returning  resume,experience,comments into :resume,:experience,:comments";

    $stmt = OCIParse($dbh, $query);

    $clob1 = OCINewDescriptor($dbh, OCI_D_LOB);
    $clob2 = OCINewDescriptor($dbh, OCI_D_LOB);
    $clob3 = OCINewDescriptor($dbh, OCI_D_LOB);
   
    OCIBindByName ($stmt, ":resume", &$clob1, -1, OCI_B_CLOB);
    OCIBindByName ($stmt, ":experience", &$clob2, -1, OCI_B_CLOB);
    OCIBindByName ($stmt, ":comments", &$clob3, -1, OCI_B_CLOB);

    OCIExecute($stmt, OCI_DEFAULT);
   
    @$clob1->save ($resume[$i]);
    @$clob2->save ($experience[$i]);
    @$clob3->save ($comments[$i]);
   
    OCICommit($dbh);
85276 at gmx dot net
09-Nov-2001 04:16
<?
// offset and limit feature for oracle 8 database selects

$conn = OCILogon("user","pw","server.world");

$sql="
declare
  type c_type is ref cursor;
  c_data c_type;
  c_null tab.row_id%type;
begin
  open :c_data for
    select row_id from tab order by row_id;
  while :c_data%rowcount < :c_init loop
    fetch :c_data into c_null;
  end loop;
end;
"
;

$stmt=OCIParse($conn, $sql);
$curs=OCINewCursor($conn);

$offset=100; // dont fetch the first 100 rows
$limit=10; // we want exactly 10 rows

OCIBindByName($stmt,":c_init",$offset,32);
OCIBindByName($stmt,":c_data",$curs,-1,OCI_B_CURSOR);

OCIExecute($stmt);
OCIExecute($curs);

for (
$i=0;$i<$limit&&OCIFetchinto($curs,$cols,OCI_ASSOC);$i++)
  print
$cols[ROW_ID]."\n";

OCIFreeStatement($stmt);
OCIFreeCursor($curs);
OCILogoff($conn);

?>
ruudb at stress dot utwente dot nl
27-Oct-2001 08:28
I had big problems to get an Oracle 7 server working with the OCI8 client and PHP under Linux, while connection to an Oracle 8 server worked great (In fact I got an ORA-01005 when connecting to Oracle 7). I see that more people have this problem, so here is the solution:

1. Make sure the NLS files are in your ORACLE_HOME subtree under $ORACLE_HOME/ocommon/nls/admin/data.

2. Make sure the ORA_NLS33 parameter is unset or alternatively pointing to the above directory ($ORACLE_HOME/ocommon/nls/admin/data).

3. Add "export ORACLE_HOME=/usr/local/oracle" (for example) to your apache startup script. This is important!! Adding this variabele in the httpd.conf OR in your PHP script will _NOT_ solve the problem: the directory has to be known before the Oracle library is loaded.

Thanks to Ron Reidy for helping to tackle this problem.
ned at wgtech dot com
08-Sep-2001 04:48
Using OCI8 it seems putenv() doesn't seem to work for oracle environment (at least with Linux/Apache) variables, but once you get connected try issuing the sql stament:
ALTER SESSION SET NLS_whatever = value;
Seems to overide any default NLS parameters.
doug at redhive dot com
20-Jul-2001 06:38
if you feel like you have too many oracle statements clouding up your php, i came up with a function to open a connection (if necessary), parse your sql statement, and return the executed query.  after you call the function, you can do whatever needs to be done.  makes like so much simpler: (do whatever you want with the errors)

function execute_query($query, &$connected) {
    global $ORACLE_USER, $ORACLE_PASS, $ORACLE_SID;

    if(!$connected) {
        $connected = @OCIPLogon($ORACLE_USER, $ORACLE_PASS,  $ORACLE_SID);

        if($error = OCIError()) {
            die("<font color=red>ERROR!! Couldn't connect to server!</font>");
        }
    }

    $stmt = @OCIParse($connected, $query);
    if($error = OCIError($cn))    {
        die("<font color=red>ERROR!! Statement syntax error!</font>");
    }

    @OCIExecute($stmt);
    if($error = OCIError($stmt)) {
        die("<font color=red>ERROR!! Could not execute statement!</font>");
    }

    return $stmt;
}
alexis at castanares dot com
11-Jul-2001 05:15
If you are getting the nasty ORA-12154 errors, try adding your http daemon user (listed in you httpd.conf file as "User" & "Group") to the same group as the Oracle Owner user, then be sure that the ORACLE_HOME environment variable is set to the Oracle Home Path, when you start apache.
jasendorf at lcounty dot com
24-May-2001 07:48
VERY IMPORTANT!  OCIPLogon only keeps a persistent connection if you are running PHP as a module.  This is particularly important to Windows users who are used to running PHP as a CGI.
fsegtrop at estiem dot org
22-May-2001 11:14
When using PHP4 in CGI-mode with Windows NT or Windows 2000 with IIS or Apache, make sure that the TNSNAMES.ORA and the SQLNET.ORA do not contain DOS/Windows CR/LF line endings.<br> Instead, they must have UNIX (only LF) endings. Otherwise, you will get an ORA-12154 error (TNS cannot resolve service name) when connecting to a remote database.<br>
This all does not matter if you use the ISAPI mode.

Frank
junk at netburp dot com
19-Oct-2000 06:39
Here's a clue about rowid.

Don't forget about the oracle functions:

"rowidtochar" and "chartorowid"

"select rowidtochar(rowid) as FOO from table ...."

When you want to pass the rowid in a form or link, that's
the only way to go.
shmengie_2000 at yahoo dot com
03-Oct-2000 07:43
couple of notes about startup/shutdown on linux:  (redhat, maybe others)

export LD_PRELOAD=/usr/lib/libpthread.so

Caused the start/stop script to fail to stop the httpd process. 
The LD_PRELOAD environment var caused the 'ps' command to core dump.  I went bald figuring that out.

Easiest fix I could think of was to move all the oracle/php varialble exports so they are only set in the start section of the httpd script.

Never thought setting those vars globally in the script would cause problems.  That's what I get for thinking...

One other note:  Make sure the httpd process is shutdown before Oracle.

eg:
/etc/rc.d/rc0.d/K15httpd
/etc/rc.d/rc0.d/K25Oracle

Lingering connections to oracle may cause shutdown to take forever.

gl & hf

-Joe
ojones at dotclick dot com
19-May-2000 11:14
If you're using OCI calls from apache/mod_php, and getting ORA-12514 errors, it's important to make sure your ORACLE_HOME environment variable is defined when you start apache.  If you use /etc/rc.d/init.d/httpd to start apache, simply put the environment variable definition in there.

This ORA-12514 error is baffling, because there isn't any such error code.  It actually should be ORA-12154 (but there's an error-code transposition somewhere in Oracle 8.1.5.0.2, on Linux).

oci_bind_array_by_name" width="11" height="7"/> <overload
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites