ORACLE 的 php 支援說明
http://www.oracle.com/technetwork/topics/php/downloads/index.html
需要先安裝 Oracle Database Instant Client
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
下載,他會依據作業系統給你載點,並且要求你登入 oracle (免費註冊)
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
請抓取 basic 及 devel 這兩個檔案
[root@power app]# rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
[root@power app]# rpm -ivh oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
# 安裝 php-devel 、php-pear 以及 gcc 編譯套件
[root@power app]# yum install php-devel php-pear gcc
# 使用 pecl 直接安裝 http://pecl.php.net/package/oci8 ,這是一個 PHP 的元件,會需要編譯所以需要上面兩個 oracle instat client 套件的資料
[root@power app]# pecl install oci8WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading oci8-2.0.6.tgz ...
Starting to download oci8-2.0.6.tgz (189,668 bytes)
.....................................done: 189,668 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : <-- enter="" font="">-->
省略 n 行....
Build process completed successfully
Installing '/usr/lib64/php/modules/oci8.so'
install ok: channel://pecl.php.net/oci8-2.0.6
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini
# 編譯完成後請將 extension=oci8.so 這一行加入 /etc/php.ini
[root@power app]# vim /etc/php.ini
extension=oci8.so
# 重新啟動 httpd
[root@power app]# /etc/init.d/httpd restart
# 觀看 phpinfo(); 程式的內容,應該會看到 oci8 的模組已經被載入內容應該如下列
oci8
OCI8 Support | enabled |
Version | 1.4.7 |
Revision | $Revision: 321634 $ |
Active Persistent Connections | 0 |
Active Connections | 0 |
Oracle Run-time Client Library Version | 11.2.0.3.0 |
Oracle Instant Client Version | 11.2 |
Temporary Lob support | enabled |
Collections support | enabled |
Directive | Local Value | Master Value |
---|---|---|
oci8.connection_class | no value | no value |
oci8.default_prefetch | 100 | 100 |
oci8.events | Off | Off |
oci8.max_persistent | -1 | -1 |
oci8.old_oci_close_semantics | Off | Off |
oci8.persistent_timeout | -1 | -1 |
oci8.ping_interval | 60 | 60 |
oci8.privileged_connect | Off | Off |
oci8.statement_cache_size | 20 | 20 |
# 那就寫程式去巴!!! 請參考 php oci 的說明
http://www.php.net/manual/zh/function.oci-connect.php
沒有留言:
張貼留言