CakeFest 2024: The Official CakePHP Conference

要件

OCI8 3.0 が PHP 8 には含まれています。 » PECL からも利用できます。 PHP 7 については、OCI8 2.2 が » PECL から利用できます。 OCI8 は、Oracle 10g 以降のクライアントライブラリが必要です。

Oracle Database が PHP と同じマシンにある場合、 データベースのソフトウェアには必要なライブラリとヘッダファイルが含まれています。 PHP が違うマシンにある場合、 無料の »  Oracle Instant Client ライブラリを使って下さい。

Oracle Database と PHP が同じマシンで動いている場合は、必要なライブラリはデータベースソフトウェアの中にすべて含まれています。 PHP を別のマシンで動かしている場合は、無料の » Oracle Instant Client ライブラリを使います。

Oracle Instant Client を使うには、basic あるいは Basic Light の Oracle Instant Client ZIP ファイルあるいは RPM パッケージ、または DMG パッケージをインストールします。OCI8 をソースコードからビルドする場合は、さらに Instant Client の SDK もインストールして下さい。

PHP を動かすときには、少なくとも OCI8 をビルドしたときと同じバージョン以降の Oracle ライブラリを使わなければなりません。

注意:

Oracle の標準のクライアント-サーバーの ネットワークの相互運用性によって、 Oracle のクライアントとデータベースのバージョンが違っていても 接続することが出来ます。 Oracle の正式なサポート文書 ID 207303.1.を要約すると、 Oracle Client 19, 18 と 12.2 は、 Oracle Database 11.2 以降にも接続できるとのことです。 Oracle Client 12.1 は Oracle Database 10.2 以降に接続できます。 Oracle Client 11.2 は Oracle Database 9.2 以降に接続できます。

注意:

OCI8 の全機能が使えるのは、 最新バージョンの Oracle クライアントライブラリとデータベースを使っているときだけです。

add a note

User Contributed Notes 5 notes

up
5
Wilber
1 year ago
The OCI8 extension lets you access Oracle Database.

Use 'pecl install oci8' to install for PHP 8.1.

Use 'pecl install oci8-3.0.1' to install for PHP 8.0.

Use 'pecl install oci8-2.2.0' to install for PHP 7.

Use 'pecl install oci8-2.0.12' to install for PHP 5.2 - PHP 5.6.

Use 'pecl install oci8-1.4.10' to install for PHP 4.3.9 - PHP 5.1.

[username@hostname ~]# php -v
^ To see PHP version
up
4
Andi,post at rueckauer dot nospam dot ch
5 years ago
The provided link to the Oracle Instant Client is not valid anymore. Visit http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html instead.
up
3
Rainer Perske
6 years ago
Oracle Instant Client provides its own LDAP library that may be incompatible to the LDAP library provided by the operating system.

Segmentation faults and other errors can happen if you load an OCI8 extension into a PHP containing LDAP support or if you load a PHP module with OCI8 into an Apache server with LDAP support.

But this depends heavily on the exact versions of operating system, system LDAP library, PHP, OCI8, and other pieces of software involved.
up
0
charles dot fisher at arconic dot com
4 years ago
Oracle's development package includes an ldap.h file that causes compilation attempts of PHP to fail.

For the oracle-instantclient12.2-devel 64-bit RPM, this file is found in the following path:

/usr/include/oracle/12.2/client64/ldap.h

Rename this file to ldap.h-oracle.

After doing so, and assuming there are no other build problems, PHP will compile (even when ldap and oci are configured in the build).
up
0
sgfan at gmx dot net
6 years ago
I can confirm Rainer's observations and this not limited to PHP. One cannot link libopenldap with C with Oracle driver without crashing the app at runtime. Same here on HP-UX. Both won't play nice at all.
To Top