oci8 PHP拡張インストール

oci8 PHP拡張インストール

CentOS 7サーバーでは、remiリポジトリからPHPをインストールしました。リモートシステムからOracle 9.2に接続する必要があります。yum install oci8oci8を介してインストールすると、OCI8 Version 2.1.0Oracle 9.2と互換性がありません。以下はphpinfo出力の内容です。

OCI8 Support    enabled
OCI8 DTrace Support enabled
OCI8 Version    2.1.0
Revision    $Id: 8e84657b6fdeaa913819689ef327ad2808110ed4 $
Oracle Run-time Client Library Version  12.1.0.2.0
Oracle Compile-time Instant Client Version  12.1

次のコマンドを使用して以前のバージョンをインストールしようとするとpecl install oci8-1.4.10失敗します。

In file included from /var/tmp/oci8/oci8.c:58:0:
/var/tmp/oci8/php_oci8_int.h:56:17: fatal error: oci.h: No such file or directory
 #include <oci.h>
                 ^
compilation terminated.
make: *** [oci8.lo] Error 1
ERROR: `make' failed

oci8バージョン1.*をインストールするにはどうすればよいですか?

ベストアンサー1

次のステップを試してみましたか? :

2 つの RPM パッケージをインストールします。

rpm -ivh instantclient-basic-linux.XXX.rpm
rpm -ivh instantclient-sdk-linux.XXX.rpm

いくつかの前提条件のインストール

yum install php-pear yum install php-devel

OCI8拡張プログラムのダウンロード

pear download pecl/oci8 
tar xvzf oci8-1.4.7.tgz 
cd oci8-1.4.7/phpize

Oracleクライアント・ライブラリー・パスを使用して拡張を構成します(自分のバージョンに応じてパスを…/11.2/…に変更)。

./configure --with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client64/lib/

コンパイルとインストール

make 
make install

SELinuxの設定:httpdが実行可能で書き込み可能なメモリアドレスを必要とするプログラムを実行できるようにします。

setsebool -P httpd_execmem 1

php.iniの最後に次の設定を追加します。

vi /etc/php.ini
[OCI8] extension=oci8.so

Apacheの再起動

service httpd restart

源泉:http://antoine.hordez.fr/2012/09/30/howto-install-oracle-oci8-on-rhel-centos-fedora/

おすすめ記事