ID: 32361
Comment by: emiliano dot ticci at dada dot net
Reported By: diego dot veiga at embraer dot com dot br
Status: Open
Bug Type: OCI8 related
Operating System: Fedora3
PHP Version: 5CVS, 4CVS (2005-03-22)
New Comment:
While waiting for an official fix I solved by commenting and
decommenting some lines. This is my diff file for oci8.c (Php 5.0.4):
1103c1103
< #if 0
---
> /* #if 0 commented to avoid connection stay persist */
1109c1109
< #endif
---
> /* #endif */
3204a3205
> /* Prevents a recursive call to this function (?)
3207a3209
> */
I don't know if this could be a good solution, however it seems to work
perfectly...
Sorry for my poor english.
Previous Comments:
------------------------------------------------------------------------
[2005-03-22 13:54:13] diego dot veiga at embraer dot com dot br
hi
yes, yesterday i installed the php-5.0.3 and this morning i installed
the CVS snapshot... i'm doing tests but is the same error.
:o(
------------------------------------------------------------------------
[2005-03-21 17:45:27] diego dot veiga at embraer dot com dot br
I upgraded the php to 5.0.3 and reproduce the same error, it seems the
oci_connect is working like the oci_pconnect.
Does anybody has an idea?
------------------------------------------------------------------------
[2005-03-18 13:22:14] diego dot veiga at embraer dot com dot br
Description:
------------
machine 1:
Linux redhat 7.2 2.4.18 #4 Fri Apr 12 08:10:27 BRT 2002 i686 unknown
configure with php4.3.4 and apache 1.3.29
./configure --with-dbtcp=/usr/src/dbtcp-0.1.17
--with-oci8=/ora8i/u01/app/oracle/product/8.1.6 --enable-track-vars
--enable-sigchild --enable-trans-sid
--with-apache=/usr/src/apache_1.3.29 --with-unixODBC --enable-xslt
--with-xslt-sa
blot=/usr/local --with-expat-dir=/usr/local --with-gd
--enable-gd-native-ttf --with-jpeg-dir=/usr --with-zlib-dir=/usr
--with-zlib=/usr/ --with-freetype-dir=/usr/local/include/freetype2
--with-png-dir=/usr --with-openssl=/usr/local/ssl
--with-config-file-path=/etc/php --sysconfdir=/etc/php
--with-pdflib=/usr/local --without-mysql --with-tiff-dir=/usr -
-with-java=/usr/java/j2sdk1.4.0_03 --enable-shared --with-layout=GNU
machine 2:
Linux fedora3 2.6.9-i386-1 #3 SMP Thu Feb 17 16:06:06 BRST 2005 i686
i686 i386 GNU/Linux
configure with php5.0.2 and apache 1.3.33
./configure --with-dbtcp=/usr/src/dbtcp-0.1.18a
--with-oci8=/ora8i/u01/app/oracle/product/8.1.6 --enable-sigchild
--enable-trans-sid --enable-track-vars
--with-apxs=/usr/local/apache/sbin/apxs --with-unixODBC --enable-xsl
--with-exp
at-dir=/usr/local/ --with-gd --enable-gd-native-ttf
--with-jpeg-dir=/usr --with-zlib-dir=/usr --with-zlib=/usr --with-
freetype-dir=/usr/ --with-png-dir=/usr --with-openssl=/usr
--with-config-file-path=/etc/php --sysconfdir=/etc/php --wi
th-pdflib=/usr/local --without-mysql --with-tiff-dir=/usr
--with-java=/usr/java/j2sdk1.4.0_03 --enable-shared --with-l
ayout=GNU
version of oracle: client 8.1.6, server 8.1.7
both machine with the php and include...
Reproduce code:
---------------
include:
function SetDatabase( $database )
{
case 'ORA_PROD' :
global $ORACLEVARS;
$ORACLEVARS['database'] = 'ORA_P';
$ORACLEVARS['username'] = 'xxxxx';
$ORACLEVARS['password'] = 'yyyyy';
break;
}
function sql_connect_simple(){
global $ORACLEVARS;
if ( $ORACLEVARS['log'] )
__log('CON:' . $ORACLEVARS['database']);
//$ORACLEVARS['conn'] = OCILogon( $ORACLEVARS['username'],
$ORACLEVARS['password'], $ORACLEVARS['database'] );
$ORACLEVARS['conn'] = oci_connect( $ORACLEVARS['username'],
$ORACLEVARS['password'], $ORACLEVARS['database'] );
}
function sql_query( $sql, $update = 0 ) {
global $ORACLEVARS;
if ( $ORACLEVARS['conn'] == 0 ) {
__err('*** QUERY: NOT CONNECTED');
return 0;
}
if ( $ORACLEVARS['log'] )
__log('QUE:' . $sql);
$handle = oci_parse( $ORACLEVARS['conn'], $sql );
if ( ! $handle ) {
__err('*** QUERY: PARSE ERROR');
return 0;
}
if ( ! oci_execute( $handle, $ORACLEVARS['mode'] ) ) {
__err('*** QUERY: EXECUTE ERROR');
oci_free_statement($handle);
return 0;
}
if ( $update ) {
oci_free_statement($handle);
$handle = 0;
}
$ORACLEVARS['dataset'][$handle] = 0;
return $handle;
}
php:
$SQL = '';
$SQL .= ' SELECT ';
$SQL .= ' NUM_BOL, ( ';
$SQL .= ' SGL_COLC_BOL ||';
$SQL .= ' TRIM(COD_PROJ_AENV) || ';
$SQL .= ' \'-\' || ';
$SQL .= ' TRIM(COD_CAP_A100) || \'-\' ||
';
$SQL .= ' IND_ALRT_BOL || ';
$SQL .= ' TRIM(TO_CHAR(NUM_SEQ_BOL, \'000\')) || \'/\' ||
';
$SQL .= ' TRIM(TO_CHAR(NUM_REV_BOL, \'00\')) ';
$SQL .= ' ) AS NUM_BOL_FORMTD, ';
$SQL .= ' NUM_REV_BOL, ';
$SQL .= ' DSC_TITL_BOL ';
$SQL .= ' FROM ';
$SQL .= ' CBS.CBS_BOLETIM';
$SQL .= ' WHERE 1=1';
$SQL .= ' AND ROWNUM <= ' . $P_QT;
$SQL .= ' AND COD_PROJ_AENV = \'' . $P_STR_COD_PROJ_AENV
. '\'';
$SQL .= ' AND SGL_COLC_BOL in (\'SB\', \'BS\') ';
$SQL .= ' ORDER BY ';
$SQL .= ' NUM_BOL ';
SetDatabase('ORA_P');
sql_connect_simple();
$RESULT = sql_query($SQL);
Expected result:
----------------
In php4.3.4
monitoring the status of connection with netstat the webserver connect
and disconnect to the server ORA_P:
while true; do netstat | grep ORA_P; echo; sleep 1; done
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521 TIME_WAIT
tcp 0 0 webserver:32896 ORA_P:1521 TIME_WAIT
tcp 0 0 webserver:32896 ORA_P:1521 TIME_WAIT
In 5.0.2
monitoring the status of connection with netstat the connection becomes
persist after the page is process, it's only disconnect with the Oracle
idle/time.
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
tcp 0 0 webserver:32896 ORA_P:1521
ESTABLISHED
I need that the connection in php 5.0.2 become non persist connection
with oracle.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32361&edit=1