reference/oci8/connection.xml
5e41012cfdf8f2eff5fa56de446c7656afac536c
...
...
@@ -20,7 +20,7 @@
20
20
only occur once per PHP process (or Apache child).
21
21
</para>
22
22
<para>
23
-
If the application connects to Oracle using a different set of
23
+
If the application connects to Oracle using a different set of database
24
24
credentials for each web user, the persistent cache employed by
25
25
<function>oci_pconnect</function> will become less useful as the
26
26
number of concurrent users increases, to the point where it may
...
...
@@ -59,7 +59,7 @@
59
59
The <function>oci_pconnect</function> cache is cleared and any
60
60
database connections closed when the PHP process terminates, so
61
61
effective use of persistent connections requires that PHP be an
62
-
Apache module or used with FCGI, or similar. Persistent connections
62
+
Apache module or used with FPM, or similar. Persistent connections
63
63
will not have any benefits over <function>oci_connect</function>
64
64
when PHP is used with CGI or via the command-line.
65
65
</para>
...
...
@@ -71,11 +71,31 @@
71
71
<function>oci_new_connect</function>, especially in the busiest sections of
72
72
the application.
73
73
</para>
74
+
<para>
75
+
Persistent connections can be
76
+
closed by the user, allowing greater control over connection
77
+
resource usage. Persistent connections will now also be closed
78
+
automatically when there is no PHP variable referencing them, such
79
+
as at the end of scope of a PHP user function. This will rollback
80
+
any uncommitted transaction. These changes to persistent
81
+
connections make them behave similarly to non-persistent
82
+
connections, simplifying the interface, allowing for greater
83
+
application consistency and predictability.
84
+
Use <link linkend="ini.oci8.old-oci-close-semantics">oci8.old_oci_close_semantics</link>
85
+
set to
86
+
<emphasis>On</emphasis> to retain the historical behavior.
87
+
</para>
88
+
<para>
89
+
The automatic re-establishment of PHP persistent connections after an Apache
90
+
or FPM process respawns means Oracle Database <literal>LOGON</literal>
91
+
triggers are only recommended for setting session attributes and not for
92
+
per-application user connection requests.
93
+
</para>
74
94
</section>
75
95
<section>
76
96
<title>DRCP Connection Pooling</title>
77
97
<para>
78
-
PHP from 5.3 (PECL OCI8 1.3) supports Oracle Database Resident
98
+
PHP supports Oracle Database Resident
79
99
Connection Pooling (DRCP). DRCP allows more efficient use of
80
100
database machine memory and provides high scalability. No, or
81
101
minimal, application changes are needed to use DRCP.
...
...
@@ -106,7 +126,7 @@
106
126
white paper</link> contains background information on DRCP.
107
127
</para>
108
128
<para>
109
-
To use DRCP, build PHP with the OCI8 1.3 (or later) extension and Oracle 11g (or later)
129
+
To use DRCP, install the OCI8 extension and Oracle 11g (or later)
110
130
libraries and then follow these steps:
111
131
</para>
112
132
<para>
...
...
@@ -206,107 +226,20 @@
206
226
</para>
207
227
<note>
208
228
<para>
209
-
Applications using Oracle 10g that require the performance of
229
+
Applications using Oracle Client libraries 10g that require the performance of
210
230
persistent connections can reduce the amount of database server
211
231
memory needed by using Oracle <literal>Shared</literal> servers
212
232
(previously known as Multi Threaded Servers). Refer to Oracle
213
233
documentation for information.
214
234
</para>
215
235
</note>
216
-
</section>
217
-
<section>
218
-
<title>DRCP Recommendations and Known Limitations</title>
219
-
<para>
236
+
<note>
237
+
<para>
220
238
Changing a password over DRCP connections will fail with the error
221
239
<emphasis>ORA-56609: Usage not supported with DRCP</emphasis>.
222
240
This is a documented restriction of Oracle Database 11g.
223
-
</para>
224
-
<para>
225
-
From OCI8 1.3, persistent connections can be
226
-
closed by the user, allowing greater control over connection
227
-
resource usage. Persistent connections will now also be closed
228
-
automatically when there is no PHP variable referencing them, such
229
-
as at the end of scope of a PHP user function. This will rollback
230
-
any uncommitted transaction. These changes to persistent
231
-
connections make them behave similarly to non-persistent
232
-
connections, simplifying the interface, allowing for greater
233
-
application consistency and predictability.
234
-
Use <link linkend="ini.oci8.old-oci-close-semantics">oci8.old_oci_close_semantics</link>
235
-
set to
236
-
<emphasis>On</emphasis> to retain the historical behavior.
237
-
</para>
238
-
<para>
239
-
If the Oracle Database is version 11.1.0.6, then the Oracle
240
-
database patch for Oracle bug 6474441 must be applied to use DRCP.
241
-
Without this patch, errors such as <emphasis>ORA-01000: maximum
242
-
open cursors exceeded</emphasis>, <emphasis>ORA-01001 invalid
243
-
cursor</emphasis> or <emphasis>ORA-01002 fetch out of
244
-
sequence</emphasis> may occur. This bug was fixed in Oracle
245
-
11.1.0.7 onwards.
246
-
</para>
247
-
<para>
248
-
If the Oracle 11.1.0.6 database patch cannot be applied, one of the
249
-
following three workarounds can be used instead:
250
-
</para>
251
-
<para>
252
-
<itemizedlist>
253
-
<listitem>
254
-
<simpara>
255
-
Connect using Oracle <literal>Dedicated</literal>
256
-
or <literal>Shared</literal> servers instead of DRCP.
257
-
</simpara>
258
-
</listitem>
259
-
<listitem>
260
-
<simpara>
261
-
Set PHP's <link linkend="ini.oci8.statement-cache-size">oci8.statement_cache_size</link>
262
-
to 0.
263
-
</simpara>
264
-
</listitem>
265
-
<listitem>
266
-
<simpara>
267
-
Set an event in the database initialization parameter file:
268
-
<emphasis>event="56699 trace name context forever, level 128"</emphasis>.
269
-
</simpara>
270
-
</listitem>
271
-
</itemizedlist>
272
-
</para>
273
-
<para>
274
-
Oracle Database 11.1.0.7 and the Oracle Database 11.1.0.6 patch for
275
-
Oracle bug 6474441 allow PHP applications with DRCP connection to
276
-
use a database <literal>LOGON</literal> trigger to set session
277
-
properties at the time of session creation. Examples of such
278
-
settings are the NLS language and the date format.
279
-
</para>
280
-
<para>
281
-
If the Oracle 11.1.0.6 database patch cannot be applied, one of the
282
-
following workarounds can be used instead
283
-
of using <literal>LOGON</literal> triggers:
284
-
</para>
285
-
<para>
286
-
<itemizedlist>
287
-
<listitem>
288
-
<simpara>
289
-
After logon, explicitly set the session properties using PHP
290
-
application code.
291
-
</simpara>
292
-
</listitem>
293
-
<listitem>
294
-
<simpara>
295
-
Connect using Oracle <literal>Dedicated</literal>
296
-
or <literal>Shared</literal> servers instead of DRCP.
297
-
</simpara>
298
-
</listitem>
299
-
</itemizedlist>
300
-
</para>
301
-
<para>
302
-
The automatic re-establishment of PHP persistent connections after
303
-
an Apache or FCGI process respawns means <literal>LOGON</literal>
304
-
triggers in PHP are only recommended for setting session attributes
305
-
and not for per-application user connection requests. This is even
306
-
more so with DRCP due to the automatic pool sizing and with the
307
-
way <literal>LOGON</literal> triggers fire with DRCP
308
-
authentication.
309
-
</para>
241
+
</para>
242
+
</note>
310
243
</section>
311
244
</chapter>
312
245

313
246