溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

PHP增加OCI8模塊

發(fā)布時(shí)間:2020-06-09 12:55:31 來(lái)源:網(wǎng)絡(luò) 閱讀:520 作者:wangshuai1987 欄目:web開發(fā)

1. 根據(jù)實(shí)際情況選擇版本,下載oracle客戶端壓縮包和sdk壓縮包

http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

以下為 10.0.2 為例

2. 將client和sdk解壓到同一個(gè)目錄并放到操作系統(tǒng)的一個(gè)指定目錄 比如 /soft/instantclient_10_2

3. 執(zhí)行如下命令,將oracle環(huán)境變量加入到 profile

cat >>/etc/profile<<EOF
#_php_oci_instantclient
export NLS_DATE_FORMAT='yyyy-mm-dd hh34:mi:ss'
export PATH=\$PATH:/soft/instantclient_10_2
export TNS_ADMIN=/soft/instantclient_10_2
export LD_LIBRARY_PATH=/soft/instantclient_10_2
export NLS_LANG=\"AMERICAN_AMERICA.ZHS16GBK\"
export ORACLE_HOME=/soft/instantclient_10_2
EOF

4. 執(zhí)行如下命令 ,修改 oracle_client so文件權(quán)限,修改上下文安全

chcon -t texrel_shlib_t /data/soft/instantclient_10_2/*.so
chcon -t texrel_shlib_t /data/soft/instantclient_10_2/*.so.*

 

5. 讀取環(huán)境變量信息

source /etc/profile

 

6. 下載 oci8的壓縮包 并進(jìn)行編譯

http://pecl.php.net/package/oci8

 

# 指定php變量 或者在with-php-config 位置替換變量,指定 php-config目錄

PHP_DIR=php的安裝目錄

tar zxvf oci8-2.0.8.tar.gz

cd oci8-2.0.8

phpize

./configure \
--with-php-config=${PHP_DIR:?NULL}/bin/php-config \
--with-oci8=shared,instantclient,${ORACLE_HOME:?NULL}

 

make

make install

 

7. 修改 php.ini文件 增加

extension = "oci8.so"

 

8. 根據(jù)實(shí)際情況, 重啟 php 或者 apache

 

end

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI