PHP提供Oracle支援增加oci8模組

hahadelphi發表於2021-09-09

環境: CentOS7 x86_64

        PHP 7.1.2(安裝路徑:/usr/local/php7.1.2)

        Oracle 11G R2



1.下載Oracle客戶端:()

instantclient-basic-linux.x64-11.2.0.4.0.zip

instantclient-sdk-linux.x64-11.2.0.4.0.zip


2.下載php oracle模組

1 wget http://pecl.php.net/get/oci8-2.1.4.tgz


3.安裝依賴包

1 yum -y install autoconf automake gcc libaio-devel unzip


4.安裝


cd ~unzip instantclient-basic-linux.x64-11.2.0.4.0.zipunzip instantclient-sdk-linux.x64-11.2.0.4.0.zipcp instantclient_11_2/libclntsh.so.11.1 instantclient_11_2/libclntsh.sotar zxf oci8-2.1.4.tgzcd oci8-2.1.4/usr/local/php7.1.2/bin/phpize./configure --with-php-config=/usr/local/php7.1.2/bin/php-config --with-oci8=instantclient,/instantclient_11_2 make && make installecho 'extension = "oci8.so"'>>/usr/local/php7.1.2/etc/php.ini


5.測試

12 /usr/local/php7.1.2/bin/php -m |grep ocioci8

$conn = oci_connect('username','password','192.168.1.100/ORCL');$sql "select * from table_name "$ora_test = oci_parse($conn,$sql);oci_execute($ora_test,OCI_DEFAULT);while($r=oci_fetch_row($ora_test))echo $r[0]; echo "
"
;   }?>



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2471/viewspace-2805129/,如需轉載,請註明出處,否則將追究法律責任。

相關文章