php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21773 The process is killed after OCIFetch()
Submitted: 2003-01-20 10:01 UTC Modified: 2003-01-22 05:45 UTC
From: sangelillis at abacosystem dot it Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.3.0 OS: Solaris 2.8
Private report: No CVE-ID: None
 [2003-01-20 10:01 UTC] sangelillis at abacosystem dot it
Hello,

we have a PHP script that run in a infinite loop looking 
on ORACLE DB (8.1.7). In each loop a SELECT is done, if this doesn't return data then the SELECT is executed after two seconds. If after not certain time the SELECT doesn't return data then when it returns data the process is killed after OCIFetch(), view code for understand better.

//START

$dbConnection = @OCILogon(USER_ID, PASSWORD, SID);
// infinite loop
$error=0;
do	
{
   $query="SELECT DATA FROM PROV";
   $stmt = @OCIParse($dbConnection,$query);
   @OCIDefineByName($stmt,"DATA",&$data);
   @OCIExecute($stmt);
   $err_ora = @OCIError($stmt);
   if ($err_ora)  
   {	
	$error=1;	
					 
   }

   While (@OCIFetch($stmt) && ($error==0))
   {
       ....
       ....

   }
   @OCIFreeStatement($stmt);
   sleep(2);

}while ($error==0);



Thanks for any suggestion

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-20 10:19 UTC] michael dot mauch at gmx dot de
This is not an infinite loop, it runs only while ($error==0).

And then there's a time limit for every PHP script, see
<http://www.php.net/manual/en/function.set-time-limit.php>.

Better ask such questions in the php.db mailing list, see <http://www.php.net/mailing-lists.php>.
 [2003-01-20 10:51 UTC] sangelillis at abacosystem dot it
Before the connection to the db it is present the following statement:

//Set max execution time to infinite

set_time_limit(0);

The loop is stopped when there is an error, in this case the variable $error=1.

Thanks
 [2003-01-20 10:51 UTC] sangelillis at abacosystem dot it
Before the connection to the db it is present the following statement:

//Set max execution time to infinite

set_time_limit(0);

The loop is stopped when there is an error, in this case the variable $error=1.

Thanks
 [2003-01-20 14:52 UTC] iliaa@php.net
Do you see "OCI8 Recursive call!" such an error message?
 [2003-01-21 03:19 UTC] sangelillis at abacosystem dot it
I don't receive any error or I don't perhaps succeed in capturing it.
 [2003-01-21 17:18 UTC] michael dot mauch at gmx dot de
Can you please try without these @ signs? If you don't like the errors/warnings being displayed on your webpages, you can turn display_errors off and log_errors on, so you can find the errors/warnings in your log file.

ini_set('display_errors','0');
ini_set('log_errors','1');
 [2003-01-22 03:44 UTC] sangelillis at abacosystem dot it
I have tried without @ but the visualization of any errors is not had, the process falls without leaving anybody trace.
The following version of the script is more complete:

<?php

set_time_limit(0);

ini_set('display_errors','0'); 
ini_set('log_errors','1'); 
//START

$dbConnection = @OCILogon(USER_ID, PASSWORD, SID);
// infinite loop
$error=0;
do	
{
   $query="SELECT DATA FROM PROV";
   $stmt = @OCIParse($dbConnection,$query);
   OCIDefineByName($stmt,"DATA",&$data);
   OCIExecute($stmt);
   $err_ora = OCIError($stmt);
   if ($err_ora)  
   {	
	$error=1;	
					 
   }

   While (OCIFetch($stmt) && ($error==0))
   {
   
       ....
       ....

   }
   
   OCIFreeStatement($stmt);
   sleep(2);

}while ($error==0);

OCILogoff($dbConnection);

?>

Thank for any suggestion
 [2003-01-22 05:45 UTC] sangelillis at abacosystem dot it
The error has been found, the function OCIFetch() is not responsible but the function echo in the cycle while it causes an error from the moment that after the run of the   
script the shell is closed.

Thank you and sorry for all.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC