Ciao,
no no c'è proprio una sezione apposita nel file php.ini
codice:
[OCI8]
; Connection: Enables privileged connections using external
; credentials (OCI_SYSOPER, OCI_SYSDBA)
; http://php.net/oci8.privileged-connect
;oci8.privileged_connect = Off
; Connection: The maximum number of persistent OCI8 connections per
; process. Using -1 means no limit.
; http://php.net/oci8.max-persistent
;oci8.max_persistent = -1
oci8.max_persistent = 1
; Connection: The maximum number of seconds a process is allowed to
; maintain an idle persistent connection. Using -1 means idle
; persistent connections will be maintained forever.
; http://php.net/oci8.persistent-timeout
oci8.persistent_timeout = 1500
; Connection: The number of seconds that must pass before issuing a
; ping during oci_pconnect() to check the connection validity. When
; set to 0, each oci_pconnect() will cause a ping. Using -1 disables
; pings completely.
; http://php.net/oci8.ping-interval
;oci8.ping_interval = 60
; Connection: Set this to a user chosen connection class to be used
; for all pooled server requests with Oracle 11g Database Resident
; Connection Pooling (DRCP). To use DRCP, this value should be set to
; the same string for all web servers running the same application,
; the database pool must be configured, and the connection string must
; specify to use a pooled server.
;oci8.connection_class =
oci8.connection_class = MYPHPAPP
; High Availability: Using On lets PHP receive Fast Application
; Notification (FAN) events generated when a database node fails. The
; database must also be configured to post FAN events.
;oci8.events = Off
; Tuning: This option enables statement caching, and specifies how
; many statements to cache. Using 0 disables statement caching.
; http://php.net/oci8.statement-cache-size
;oci8.statement_cache_size = 20
; Tuning: Enables statement prefetching and sets the default number of
; rows that will be fetched automatically after statement execution.
; http://php.net/oci8.default-prefetch
;oci8.default_prefetch = 100
; Compatibility. Using On means oci_close() will not close
; oci_connect() and oci_new_connect() connections.
; http://php.net/oci8.old-oci-close-semantics
;oci8.old_oci_close_semantics = Off
oci8.old_oci_close_semantics = On
Adesso sto cercando di usare le connect normali che vengono gestite bene.
Si chiudono sempre ma ne risente la velocità.
A questo punto ho due possibilità:
1 - incompatibiltà tra le versioni dei programmi che sto usando.
2 - le pconnect non funzionano bene lato php per dll oci
provare ad esempio:
Codice PHP:
<?php
$GLOBALS['uname'] = 'user';
$GLOBALS['pwd'] = 'password';
$GLOBALS['db']='192.168.18.101/XE';
$GLOBALS['table'] = 'nome_tabella';
function do_query($c, $query)
{
$s = oci_parse($c, $query);
oci_execute($s, OCI_DEFAULT);
oci_fetch_all($s, $res);
echo "<pre>";
var_dump($res); // PHP debugging function for displaying output
echo "</pre>";
}
try
{
$GLOBALS['conn'] = oci_pconnect($GLOBALS['uname'], $GLOBALS['pwd'],$GLOBALS['db']);
//$s = oci_parse($GLOBALS['conn'], "insert into ".$GLOBALS['table']." values ('" . date('j:M:y') . "','test')");
//oci_execute($s, OCI_DEFAULT); // does not commit
$GLOBALS['conn'] = oci_pconnect($GLOBALS['uname'], $GLOBALS['pwd'],$GLOBALS['db']);
do_query($GLOBALS['conn'], "select * from ".$GLOBALS['table']." where rownum = 1");
$GLOBALS['conn'] = oci_pconnect($GLOBALS['uname'], $GLOBALS['pwd'],$GLOBALS['db']);
do_query($GLOBALS['conn'], "select * from ".$GLOBALS['table']." where rownum = 1");
}
catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
Se eseguo questo codice una volta... 1 connessione che rimane attiva
Se faccio F5 ogni secondo... aggiunge una connessione ogni tanto
Se tengo premuto F5.. aumentano le connessioni vertiginosamente
E' come se PHP mantenesse un tempo minimo prima di rilasciare la connessione usata.
Cosa ne pensate?
Grazie a tutti