需求

OCI8 3.0 is included with PHP 8. It is also available from » PECL. For PHP 7, use OCI8 2.2 from » PECL. OCI8 requires Oracle 10g or later Oracle client libraries.

If the Oracle Database is on the same machine as PHP, the database software already contains the necessary libraries and header files. When PHP is on a different machine, use the free » Oracle Instant Client libraries.

To use Oracle Instant Client, install the Basic or Basic Light Oracle Instant Client ZIP file, RPM package, or DMG package. When building OCI8 from source code, also install the Instant Client SDK.

You must run PHP with the same, or a more recent, version of the Oracle libraries that OCI8 was built with.

Note:

Oracle's standard client-server network interoperability allows connections between different versions of Oracle Client and Oracle Database. For certified configurations see Oracle Support's Doc ID 207303.1. In summary, Oracle Client 19, 18 and 12.2 can connect to Oracle Database 11.2 or greater. Oracle Client 12.1 can connect to Oracle Database 10.2 or greater. Oracle Client 11.2 can connect to Oracle Database 9.2 or greater.

Note:

Full OCI8 feature support is only available when using the most recent versions of the Oracle client libraries and database.

User Contributed Notes

charles dot fisher at arconic dot com 27-Dec-2019 05:00
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).
Andi,post at rueckauer dot nospam dot ch 01-May-2018 12:14
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.
sgfan at gmx dot net 27-Sep-2017 09:31
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.
Rainer Perske 28-Jun-2017 06:16
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.