Page 1 of 1

[ocilogon][segmentation fault] a simple check of Oracle Co.

Posted: Mon May 16, 2005 1:29 am
by cerise
Hi every one ;)

ok, my problem is quite simple (or I hope so!). When I run the code below, and especially the line with the function ocinlogon. The sequence ends returning :

Code: Select all

php trace_co_bdd.php4 
X-Powered-By: PHP/4.2.2
Content-type: text/html

16/05/2005 08:14:57 -- 3.0292241573334 -- 0.0052239894866943 --  ;  ; Segmentation fault
Whatever I do, it ends with the 'Segmentation fault' if I let the ocinlogon function. (ocilogon and ociplogon as well)...

The oracle environment variable are set, and the DBMS is an Oracle 9i.

If you have any idea to solve the problem... It would be a great pleasure to try them ;)


Code: Select all

// this script intend to check the connection time to the DBMS
// it is intend to be called every minutes by a CRON.

if(!function_exists('__session_getmicrotime'))
{
	function __session_getmicrotime()
	{ 
	 list($usec, $sec) = explode(" ", microtime());  
	 return (float)$usec + (float)$sec ;
	}
}

define ("___OCI_SESS_DBUSER", C_USER_BDD) ;
define ("___OCI_SESS_DBPASS", C_PASSWORD_BDD) ;
define ("___OCI_SESS_DBNAME", C_BASE_BDD) ;

	$deb = __session_getmicrotime () ;
	$co = ocinlogon (___OCI_SESS_DBUSER, ___OCI_SESS_DBPASS, ___OCI_SESS_DBNAME) ;
	$fin = __session_getmicrotime () ;
	
	$tempsOpen = $fin - $deb ;	
	$erra1 = OCIError ();
	
	// quit the session !
	$debClose = __session_getmicrotime() ;
	@OCICommit ($co) ;
	$erra2 = OCIError () ;
	@OCILogoff ($co) ;
	$erra3 = OCIError () ;
	$finClose = __session_getmicrotime() ;
	
	$tempsClose = $finClose - $debClose ;
	
	$message = date ("d/m/Y H:i:s") . ' -- ' . $tempsOpen . ' -- ' .  $tempsClose . ' -- ' . $erra1 . ' ; ' . $erra2 . ' ; ' . $erra3  ;
	
	echo $message ;
	
	return $message ;