|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-01-28 22:44 UTC] ferguson at becon dot org
Apache crashes, burns and dies when i copy and paste the first ?declare? example in the php documentation....
dont ask me why it is happening. I am having troubles learning how to use declare and ticks. may be declare or ticks is not causing the problem.... beats the heck out of me.
php4.0.6 did the same thing with apache 1.3.20, but when i upgraded to apache 1.3.22, it caused and internal server error. After i updated my php to the current version, apache decided it liked to crash and burn better.
It might be good idea to update the documentation to a different example, one that does not crash.... just a thought. I know it might not be possible.
The source code is as follows:
<pre>
<?php
// A function that records the time when it is called
function profile ($dump = FALSE)
{
static $profile;
// Return the times stored in profile, then erase it
if ($dump) {
$temp = $profile;
unset ($profile);
return ($temp);
}
$profile[] = microtime ();
}
// Set up a tick handler
register_tick_function("profile");
// Initialize the function before the declare block
profile ();
// Run a block of code, throw a tick every 2nd statement
declare (ticks=2) {
for ($x = 1; $x < 50; ++$x) {
echo similar_text (md5($x), md5($x*$x)), "<br>";
}
}
// Display the data stored in the profiler
print_r (profile (TRUE));
?>
</pre>
good luck...
Brendan
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 06:00:01 2025 UTC |
having the same problem.. tried it on combinations of win2k with apache 1.3.22 and php as sapi with versions 4.2.2 , 4.2.3 and 4.4.0-dev and tried it with apache 2.0.43 with 4.4.0-dev too crashes an apache thread (probably) with a memory fault .. couldnt read from address 0x0etc . server does keep running though. when commenting //register_tick_function() it works fine. even leaving declare(ticks=1) {......} in tact. Vincent.