note 75927 added to function.register-tick-function
| From: | Jeremy at osu1 dot php dot net | Date: | Thu, 21 Jun 2007 18:03:17 +0000 |
| Subject: | note 75927 added to function.register-tick-function | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127873@lists.php.net to get a copy of this message | ||
I tried the following on an IIS 6/PHP 5 machine:
<?php
set_time_limit(0);
function profiler($return = false)
{
static $m = 0;
if($return) return $m . " bytes";
if(($mem = memory_get_usage()) > $m) $m = $mem;
}
register_tick_function('profiler');
declare(ticks = 1);
$numbers = array();
for($i=0; $i<1000000; $i++)
{
print($i . "<br />");
}
print(profiler(true));
?>
...and got the following errors:
1) PHP has encountered an Unhandled Exception Code -1073741674 at 0435EC5A
2) PHP has encountered an Access Violation at 02727891
3) PHP has encountered an Access Violation at 02727879
4) PHP has encountered an Access Violation at 00000000
So far the code hasn't crashed the web server, but like the warning says,
"register_tick_function() should not be used with threaded web server modules. Ticks are not
working in ZTS mode and may crash your web server."
Strangely enough, the code does execute successfully every once in a while.
----
Server IP: 69.39.81.135
Probable Submitter: 199.72.111.49
----
Manual Page -- http://www.php.net/manual/en/function.register-tick-function.php
Edit -- https://master.php.net/note/edit/75927
Del: integrated -- https://master.php.net/note/delete/75927/integrated
Del: useless -- https://master.php.net/note/delete/75927/useless
Del: bad code -- https://master.php.net/note/delete/75927/bad+code
Del: spam -- https://master.php.net/note/delete/75927/spam
Del: non-english -- https://master.php.net/note/delete/75927/non-english
Del: in docs -- https://master.php.net/note/delete/75927/in+docs
Del: other reasons-- https://master.php.net/note/delete/75927
Reject -- https://master.php.net/note/reject/75927
Search -- https://master.php.net/manage/user-notes.php