Jump to content


This topic is now archived and is closed to further replies.


Oracle Persistent Connection

Recommended Posts


I have recently configured php4 and Apache to works fine with Oracle 10g database on windows.


The oracle 10g does have Apache and PHP modules built in. And all work fine.


I have tried to use (ociplogon) instead of (OCILogon) and it works fine by establishing many child process connections.

But they will run for ever..


Is there any way to kill the child processes after a defined timeout or for example to kill the process that has been inactive for while.


(PS: why having many connections to the database that is not been used for while)


If there is no function in PHP to do that, can you so please help with a script code to do that.


Here is how my simple php script looks like:






$db_conn = ociplogon( "king", "camilla", "PROD" );


$cmdstr = "select FIRSTNAME, LASTNAME from person where ID BETWEEN 14106 AND 14125";


$parsed = ociparse($db_conn, $cmdstr);



$nrows = ocifetchstatement($parsed, $results);



echo "<html><head><title>Oracle PHP Test</title></head><body>";

echo "<center><h2>Oracle PHP Test</h2><br>";

echo "<table border=1 cellspacing='0' width='50%'>\n<tr>\n";

echo "<td><b>Name</b></td>\n<td><b>Salary</b></td>\n</tr>\n";


for ($i = 0; $i < $nrows; $i++ )


echo "<tr>\n";

echo "<td>" . $results["FIRSTNAME"][$i] . "</td>";

echo "<td>" . $results["LASTNAME"][$i] . "</td>";

//echo "<td>$ " . number_format($results["PERSONMASTER_ID"][$i], 2). "</td>";

echo "</tr>\n";



echo "<tr><td colspan='2'> Number of Rows: <B>$nrows</B></td></tr></table>";

echo "<br><em>Tillykke Wessam!</em><br></center></body></html>\n";







Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.