Apache Crashes when code used

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Apache Crashes when code used

Post 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..
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

might want to look into the php bug reports.. because i think to have seen this issue with register_tick_function before...
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

that sucks... i was trying to learn how the declare/tick functions worked too..

lol.. oh well. thanks for the heads up.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post 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.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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...
Post Reply