From: diego dot veiga at embraer dot com dot br
Operating system: fedora 3
PHP version: 5.0.2
PHP Bug Type: Oracle related
Bug description: connection oci_connect stay persist after process the php
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 bug report at http://bugs.php.net/?id=32361&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32361&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32361&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32361&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32361&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32361&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32361&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32361&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32361&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32361&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32361&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32361&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32361&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32361&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32361&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32361&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32361&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32361&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32361&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32361&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32361&r=mysqlcfg