Created
January 26, 2010 14:44
-
-
Save mariuz/286884 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dbGet($name) | |
{ | |
echo $name.": ".getmypid()."\n"; | |
$dbLogin = 'SYSDBA'; | |
$dbPassword = 'masterkey'; | |
$dbDB = '/var/lib/firebird/2.5/data/employee.fdb'; | |
$dbh = ibase_pconnect($dbDB, $dbLogin, $dbPassword); | |
if (!$dbh) | |
{ | |
echo $name.": connection error - ".ibase_errmsg()."\n"; | |
# posix_kill(getmypid(), 9); | |
} | |
$query = "SELECT * FROM EMPLOYEE;"; | |
if (!$dbResult = ibase_query($dbh, $query)) | |
{ | |
echo $name.": query error - ".ibase_errmsg()."\n"; | |
// posix_kill(getmypid(), 9); | |
} | |
$row = ibase_fetch_row($dbResult); | |
# ibase_free_result($dbResult); | |
# ibase_commit(); | |
if (empty($row)) echo $name.": row empty - ".ibase_errmsg()."\n"; | |
else echo $name.":\n".print_r($row, true); | |
} | |
// $error_reporting_level = error_reporting(0); | |
// error_reporting($error_reporting_level); | |
error_reporting(0); | |
dbGet('grandpa'); | |
// $this->obj->Log->debug('ReportGeneric before fork('.getmygid().')'); | |
$pid = pcntl_fork(); | |
if ($pid == -1) die('fork error'); | |
elseif ($pid ==0) | |
{ | |
// CHILD | |
dbGet('child'); | |
usleep(500); | |
// posix_kill(getmypid(), 9); | |
} | |
else | |
{ | |
// PARENT | |
dbGet('parent'); | |
// posix_kill(getmypid(), 9); | |
usleep(500); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment