Seg fault in my apache server using php 4 with Sybase...
| From: | Robert Nickel | Date: | Tue, 11 Jul 2000 23:30:23 +0000 |
| Subject: | Seg fault in my apache server using php 4 with Sybase... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-1053@lists.php.net to get a copy of this message | ||
If I click on refresh a number of times (4-5), I eventually get a:
[Date/Time] [notice] child pid xxxx exit signal Segmentation fault (11)
I'm not entirely certain what's the culprit, but here are the code sections.
<?php
function dienice($deathtext) {
echo "<h2>Script Execution Error</h2><BR>\n<BR>\n";
echo $deathtext;
}
function get_params() {
global $UsrInfo;
global $RptList;
global $REMOTE_USER;
$dbh=sybase_connect("DATABASE", "HELLO", "HOWAREYA");
if($dbh) {
$sql="select uid, accesslvl, reports, report_order from reports.dbo.pwp_usrs where
uid=\"$REMOTE_USER\"";
$sth=sybase_query($sql);
if($sth) {
$UsrInfo=sybase_fetch_array($sth);
} else {
dienice("Invalid user.<BR>\nContact administrator for an account.");
}
$sth=sybase_query("select ReportID, Name, ExName, Description, LvlReq, Graph, URL from
reports.dbo.pwp_reps");
if($sth) {
$count=0;
while($tmp=sybase_fetch_array($sth)) {
$RptList[$tmp[ReportID]][Name]=chop($tmp[Name]);
$RptList[$tmp[ReportID]][ExName]=chop($tmp[ExName]);
$RptList[$tmp[ReportID]][Desc]=chop($tmp[Description]);
$RptList[$tmp[ReportID]][Lvl]=chop($tmp[LvlReq]);
$RptList[$tmp[ReportID]][Grph]=chop($tmp[Graph]);
$RptList[$tmp[ReportID]][URL]=chop($tmp[URL]);
$count++;
}
} else {
dienice("Unable to get list of pages. Contact Administrator or try refresh button.");
}
} else {
dienice("Couldn\'t connect to database server");
}
}
?>
Later in the code, I index through the array to build a javascript on the page:
<?php
get_params();
ksort($RptList);
reset($RptList);
while(list ($j)=each($RptList)) {
echo "$j <BR>\n";
$RptList[$j][Desc]=ereg_replace("\"", "\\\"", $RptList[$j][Desc]);
if(((int) $UsrInfo[accesslvl]) & ((int) $RptList[$j][Lvl])) { //is this cast really
necessary?
echo " if(a==$j) msg =\"<p>";
echo $RptList[$j][Desc];
echo "</p>\"\;\n";
}
}
?>
Any help is appreciated. I can't imagine that I'm overworking my web server. It
doesn't seg fault the primary server, so it keeps running
just fine afterwards with the exception being that the page containing this script seg faults the
child with fewer refresh attempts. To me, it
looks like there is some database cleanup that isn't occuring fast enough or at all.
Vitals:
PHP4pl2 running with Apache 1.3.9 on a redhat 6.2 box ( 2.2.12 kernel ).
Thanks in advance,
--Robert