php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13977 Sometimes php crashes when executing a script everytime at the same point.
Submitted: 2001-11-07 08:03 UTC Modified: 2001-12-01 15:37 UTC
From: zork at matrixx-bielefeld dot de Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.0.6 OS: Windows 2000 SP2
Private report: No CVE-ID: None
 [2001-11-07 08:03 UTC] zork at matrixx-bielefeld dot de
Using Win2k/SP2, MySQL 3.23.44 Windows 95/98/NT/2000/XP on an AMD-Athlon-System. 
The problem is, that sometimes PHP crashes when getting data from the db.

I'm using the following code-snip to generate an click-menu:

============================================================
// Get Main-Menu from database
$mmenu = generate_menu(1,$location);

echo("<table cellspacing=0 cellpadding=0 border=0 width=\"800\">
<tr><td class=conmenu>&nbsp;&nbsp;");

//// THIS IS THE PLACE WHERE PHP CRASHES.
//// Not everytime, but often

for ($i = 1; $i <= count($mmenu) - 1; $i++) {

  echo("$mmenu[$i]&nbsp;&nbsp;|&nbsp;");

}
[...]
============================================================

I'm using more than one computer to work with the code and two diferent OS'ses (Win2k / SuSE-Linux 7.3). I just encountered problems with Win2k on the mashine with AMD-CPU.

thx,

Meikel Bode

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-07 08:07 UTC] zork at matrixx-bielefeld dot de
I exatly mean the 3. interation of the for-loop!!!
 [2001-11-08 11:51 UTC] derick@php.net
Please include the shortest possible script (preferrably link to it) that crashes PHP.
 [2001-11-09 07:02 UTC] zork at matrixx-bielefeld dot de
Hi all,

the problem is, that the script not allways crashes. It just crashes on my home pc with amd-cpu. I also put the script online (Linuxbox, Kernel 2.2.16, mod_php-4 (4.0.6), Apache/1.3.19 (Unix)  (SuSE/Linux), MySQL 3.23.43  ,and there it runs perfectly:

Here is the script:

=====================================================
<?php
//// Version 0.1
//// hcms_fe_engine.php
//// ( Frontendengine )
//// Gibt den Inhalt der Site f?r WebUser aus
/////////////////////////////////////////////////////////////
// Sessionverwaltung einbinden
include ('hcms_fe_session.php');

// Allgemeine Konfiguration einbinden
include('hcms.init.php');

// Datenbankschnittstelle einbinden
include ('hcms_smod_db.php');

// FE-Funktionen einbinden
include('hcms_fe_functions.php');

// Site-Konfiguration aus DB holen
$sConfig = getSiteConfig();

// ?berpr?fen, ob Site online ist
if ($sConfig[online] == "n") {

   header("Location: hcms_fe_siteoffline.html");  // Ausweichdokument anzeigen

} 
// Site ist online
else { 
  
   // Pr?fung ob GenTime gew?nscht
   if ($sConfig[showgentime] === "y") {
      // Start der Erstellungsdauer
      $timer = new cGenTime;
      $timer->start();
   }
   /// ENDE Pr?fung GenTime gew?nscht
   
   
   
   ////////
   //
   // Seiten-Code erzeugen
   //
   ////////
   
   if (!isset($location)) {

      $location = 1;
   
   }
   
   /// Seitenkopf generieren
   echo("<html><head><title>$sConfig[sitename]</title></head><body bgcolor=\"#999966\">");
   include('layouts/site.css');
   
   // Main-Layout-Tabelle generieren
   echo ("<center>
          <table class=bodytab cellpadding=0 cellspacing=0 border=0 width=800>");
   echo ("<tr><td colspan=3 height=81><img src=\"".$IMG_SITE."logo_head.png\" border=0 width=800></td></tr>");
   echo("<tr><td colspan=3 height=10 valign=top width=800>");

   // Main-Menu aus DB holen
   $mmenu = generate_menu(1,$location);

   echo("<table cellspacing=0 cellpadding=0 border=0 width=\"800\">
         <tr><td class=conmenu>&nbsp;&nbsp;");^


   for ($i = 1; $i <= count($mmenu) - 1; $i++) {

       echo("$mmenu[$i]&nbsp;&nbsp;|&nbsp;");
   }

^^^^^^^^^^^^^^^^^^^^^^^^
This is the part that crashes under Win2k....
The 3. iteration of the loop. Not everytime, but often....

   echo("<a href=hcms_admin_login_form.php>Login</a>");
   echo ("</td><td class=conmenu align=right>");echo(datum());echo("</tr></table>");
   
   echo("</td></tr>");

   // Kontextzeile einblenden
   echo("<tr><td class=fecx align=>
      &nbsp;&nbsp;<a href=\"$PHP_SELF\"><img src=\"pics_intern/news_haus.png\" border=0></a>
	  &nbsp;
	  <a href=\"mailto:$sConfig[webmaster]\"><img src=\"pics_intern/news_umschlag.png\" border=0></a>
      </td><td class=fecx><font color=white>Sie befinden sich <font color=orange><b> >>> </b></font> ");
      echo(getCX($location, $cx));
   echo("</font></td><td class=fecx>&nbsp;</td></tr>");
   
   
   echo("<tr><td class=tdsmenu valign=\"top\">");
   // Sub-Menu aus DB holen
   get_subcats($location);
   
   ///////////////////////////////////////////
   // Content aus DB holen
   ///////////////////////////////////////////
   echo("&nbsp;</td><td class=tdcontent valign=top>");
   //////////////

   if (isset($cx) && isset($idart)) {
     $file = renderCat($cx, $idart);
     include("$DYN_PATH$file");
	 // Tempor?re Inc-Datei nach Verwendung l?schen
	 unlink("$DYN_PATH$file");
   }
   elseif (isset($cx)) {
     $file = renderCat($cx, "");
     include("$DYN_PATH$file");
	 // Tempor?re Inc-Datei nach Verwendung l?schen
	 unlink("$DYN_PATH$file");
   } else {
     $file = renderCat($location, "");
     include("$DYN_PATH$file");
	 // Tempor?re Inc-Datei nach Verwendung l?schen
	 unlink("$DYN_PATH$file");
   }

   
   ////////////////////////////////////////	  
   echo("</td>");
   // ENDE Content aus DB holen
   ////////////////////////////////////////
   
   /////////////////////////////////////////////
   // Polls und Akutinfos aus DB holen
   echo("<td class=tdpoll>");
   
     echo("Poll");
   
   echo("</td>");
   //// Ende Polls und Akutinfos aus DB holen
   /////////////////
   echo("</tr></table></center><br>");
   
   /////////////////////////////////////////////
   /////// Nochmalige Pr?fung ob Timer gew?nscht
   if ($sConfig[showgentime] == "y") {
      // Zeit stoppen
      $timer->stop();
      echo("<hr width=800><center>Diese Seite wurde generiert in ");
      $timer->showtime();
      echo(" Sekunden</center>");
   }
   //////////////////////////////////////////////
   
   // Pr?fen, ob Poweredby-Logo gew?nscht
   if ($sConfig[showpoweredby] == "y") {
   
      echo("<br><center><a href=\"http://www.heavensoft.org\" target=_blank>
	       <img src=\"pics_intern/hcms_logo.png\" border=0></a>");
   
   }
 
   
/// Seitenfuss generieren
echo("</body></html>");
} // ENDE else Site ist online
?>

==========================================================

thx a lot,

Meikel Bode
 [2001-11-09 10:12 UTC] jeroen@php.net
Derick wrote:
> Please include the shortest possible script (preferrably link to it) that crashes PHP.

Is this the shortest?? Try to weed out lines until it doesn't crash anymore, because your script is a bit too long to check, and it's not self-containing either, it won't run because of parse errors and missing includes.

YOu say it's because of DB access, try to do the specific queries only, and nothing else.
 [2001-12-01 15:37 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon May 05 22:01:30 2025 UTC