mac php7 编译oci8,使用PHP7可以提高oci8性能嗎?

DRCP連接池從5.3(PECL OCI8 1.3)

PHP支持Oracle數據庫駐留連接池(DRCP)。 DRCP允許更高效地使用數據庫機器內存並提供高可擴展性。使用DRCP不需要或者很少的應用程序更改。

DRCP適用於使用少量數據庫模式連接並使數據庫連接在短時間內保持打開狀態的應用程序。其他應用程序應使用Oracle的默認專用數據庫服務器進程,或使用共享服務器。

DRCP有利於所有三種連接功能,但在使用oci_pconnect()創建連接時提供最高的可擴展性。

對於OCI8中可用的DRCP,PHP使用的Oracle客戶端庫和Oracle數據庫版本必須均爲11g或更高。

有關DRCP的文檔可以在幾個Oracle手冊中找到。例如,請參閱»在Oracle文檔中配置數據庫駐留連接池以獲取使用信息。 »DRCP白皮書包含關於DRCP的背景信息。

要使用DRCP,與OCI8 1.3(或更高版本)的擴展和Oracle 11g(或更高版本)庫編譯PHP,然後按照下列步驟操作:

As a privileged database administrator, use a program like SQL*Plus to start the connection pool in the database:

SQL> execute dbms_connection_pool.start_pool;

Optionally use dbms_connection_pool.alter_param() to configure DRCP settings. The current pool settings can be queried from the DBA_CPOOL_INFO view.

Update the connection strings used. For PHP applications that currently connect using a Network Connect Name like MYDB:

$c = oci_pconnect("myuser", "mypassword", "MYDB");

modify the tnsnames.ora file and add a (SERVER=POOLED) clause, for example:

MYDB = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=myhost.dom.com)

(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales)

(SERVER=POOLED)))

Alternatively, modify the Easy Connect syntax in PHP and add :POOLED after the service name:

$c = oci_pconnect("myuser", "mypassword", "myhost.dom.com:1521/sales:POOLED");

Edit php.ini and choose a connection class name. This name indicates a logical division of the connection pool and can be used to isolate pooling for separate applications. Any PHP applications with the same user name and connection class value will be able to share connections in the pool, giving greater scalability.

oci8.connection_class = "MY_APPLICATION_NAME"

Run the application, connecting to the 11g (or later) database.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值