|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-09-17 07:24 UTC] moron at industrial dot org
I am experiencing some really annoying behaviour under PHP 4 that appears to be a bug in PHP but maybe is some issue to do with upgrading? Anyways, using the DBF read functions results in random seg faults (Apache's error_log states "child pid 12345 exit signal Segmentation Fault"). This seems to have no rhyme or reason - it will crash on one run and work on fine on the next. I thought it was a timeout issue initially but that seems to not be the case. I am working with an 8000 line DBF file which I have another script that is trying to import it into a MySQL database. The example code below is just to show the bug and just reads the file out. It fails about 40% of the time for me. My "real" script dies consistently though, probably due to the amount of other stuff going on. If you need an example dbf file please let me know.
<?PHP
if($fp = dbase_open("./import/prices1.DBF",0)) {
$num_records=dbase_numrecords($fp);
$x=1;
echo "<TABLE WIDTH=100%>\n";
while(($x<=800)&&($x<=$num_records)) {
echo "<TR>";
if(! ($row = dbase_get_record_with_names($fp, $x))) { $x++; next; }
reset($row);
while(key($row)) { echo "<TD>Field: ".key($row)."=".$row[ key($row) ]."</TD>\n"; next($row); }
unset($row);
flush();
$x++;
echo "</TR>\n";
}
flush();
printf("<TR><TD WIDTH=20%% ALIGN=RIGHT BgColor=#8080c0></TD><TD WIDTH=20%% ALIGN=CENTER></TD><TD WIDTH=60%%><FONT face=\"arial, helvitica\">%d records read</FONT></TD></TR>\n",$x-1);
echo "</TABLE>\n";
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 14:00:01 2025 UTC |
This bug still exists in PHP 4.3.2-RC2. -----[ Code ]----- #!/bin/php -q <?php $db = dbase_open("../../Student_Data/teacher.dbf",2); print "I found ".dbase_numrecords($db)." # " . dbase_numfields($db) . " records\n"; dbase_pack($db); $stk = dbase_get_record_with_names($db,1); print "OK"; ?> -----[ Output ]----- (towely) Old# ./teacher.php I found 3178 # 13 records Segmentation fault -----[ PHP Configuration ]----- ./configure --prefix=/usr/local \ --with-apache=../www \ --with-gettext \ --with-gd \ --with-jpeg-dir=/usr/local \ --with-mcrypt=/usr/local \ --with-mcal=/usr/local \ --with-ming=/usr/local \ --with-mhash=/usr/local \ --with-mysql=/usr/local \ --with-pdflib=/usr/local \ --with-zlib=/usr/local \ --with-ncurses=/usr/local \ --with-tiff-dir="/usr/local" \ --with-unixODBC=/usr/local/unixODBC \ --with-xml \ --with-calendar=shared \ --with-png-dir=/usr/local \ --with-freetype=/usr/local \ --with-freetype-dir=/usr/local \ --with-ttf=/usr/local \ --with-fdftk=/usr/local \ --with-openssl=/usr/local \ --with-bz2 \ --with-dom \ --with-mm \ --with-pspell=/usr/local \ --enable-localizer \ --enable-bcmath \ --enable-calendar \ --enable-dio \ --enable-exif \ --enable-ftp \ --enable-gd-native-ttf \ --enable-pcntl \ --enable-shmop \ --enable-sigchild \ --enable-sockets \ --enable-track-vars \ --enable-magic-quotes \ --enable-trans-sid \ --enable-libgcc \ --enable-wddx \ --enable-sysvshm \ --enable-sysvsem \ --enable-sysvmsg \ --enable-mbstring \ --enable-mbstr-enc-trans \ --enable-dbase \ --enable-mbregex If there is any other data you need, please let me know. Tim