Page 1 of 1

Apache Crashes when code used

Posted: Thu Apr 07, 2005 2:40 am
by infolock
Any idea why apache would crash when this code is run?

Code: Select all

<?php
function profile($dump = FALSE)
{
   static $profile;
   if ($dump) {
       $temp = $profile;
       unset($profile);
       return($temp);
   }
   $profile[] = microtime();
}
register_tick_function("profile");
profile();
declare(ticks=2) {
   for ($x = 1; $x < 50; ++$x) {
       echo similar_text(md5($x), md5($x*$x)), "<br />;";
   }
}
print_r(profile(TRUE));
?>
also, just for a test, could someone else try running this code and see if it crashes for them, or if it's just me and my configuration..

Posted: Thu Apr 07, 2005 4:44 am
by timvw
might want to look into the php bug reports.. because i think to have seen this issue with register_tick_function before...

Posted: Thu Apr 07, 2005 8:53 am
by John Cartwright
user comments wrote:If your script will be used on Windows sytems running Apache, its best to stay away from this function... and for portability purposes, try and use a different function.

In most cases it will crash apache continually until the page is stopped from loading.

Posted: Thu Apr 07, 2005 11:37 am
by infolock
that sucks... i was trying to learn how the declare/tick functions worked too..

lol.. oh well. thanks for the heads up.

Posted: Thu Apr 07, 2005 4:11 pm
by Weirdan
infolock wrote:that sucks... i was trying to learn how the declare/tick functions worked too..

lol.. oh well. thanks for the heads up.
Apache/PHP for windows sucks. Crashes for me every time I'm trying to get any quirky PHP code to run.

Posted: Thu Apr 07, 2005 5:03 pm
by timvw
must say that since ive started apache2 i haven't experienced really weird things anymore... but that could be because i haven't used exotic extensions on that winmachine...