Configure register_tick_function() in xampp

Asked

Viewed 51 times

-3

I’m trying to use the function register_tick_function(), but it’s crashing my development server. But I’m also unable to use that same function on the production server.

I ask you to help me, please, to configure on my server the use of the function register_tick_function() and similar functions.

I thank you in advance! If you do not know advanced PHP do not answer or vote negative, because it is an advanced topic.

  • 2

    Hi, M., it’s not at all clear if you’re locking into the dev E server in the Prod, or just one but not the other... What do the error logs show? In what context are you using the function?

1 answer

0


I don’t know what your code is, but it’s likely you haven’t declared the ticks=1, the documentation in Portuguese does not present a correct example, according to the documentation in English:

Follow an example of use:

<?php
declare(ticks=1);

// A function called on each tick event
function tick_handler()
{
    echo "tick_handler() called\n";
}

register_tick_function('tick_handler');

$a = 1;

if ($a > 0) {
    $a += 2;
    print($a);
}

I do not recommend using in production. Another detail is very unlikely, but if your server is PHP5.2 this will not work if the module is "threaded":

Warning register_tick_function() should not be used with threaded web server modules with PHP 5.2 or Lower.

Related:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.