PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > confused by php ticks
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
confused by php ticks

Réponse
 
LinkBack Outils de la discussion
Vieux 26/03/2008, 16h17   #1
actioncem@googlemail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut confused by php ticks

I am discovering some really weird behaviour of php while using ticks
and register_tick_function(). I've already searched the web and some
newsgroups, but I didn't find any suitable postings for my problem.

Here comes an example script:

<?php

// define tick function
function checkUsage() {
echo ".";
}

// register tick function
register_tick_function('checkUsage');

// declare ticks
declare(ticks = 1);

for($i = 0; $i < 1000; $i++) {
echo '|';
}

?>

If you execute this script, you can see, that php is doing some ticks
before the for-loop passes by the first time. That's no problem - yet.
If I execute the script immediately again, the ticks between the loop
passes counting higher and higher. I need to wait about one minute
till the output is as expected.

Can someone explain that to me?

Cheers,

Cem

P.S.: I'm sorry for my poor english
  Réponse avec citation
Vieux 26/03/2008, 17h22   #2
Erwin Moller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: confused by php ticks

actioncem@googlemail.com schreef:
> I am discovering some really weird behaviour of php while using ticks
> and register_tick_function(). I've already searched the web and some
> newsgroups, but I didn't find any suitable postings for my problem.
>
> Here comes an example script:
>
> <?php
>
> // define tick function
> function checkUsage() {
> echo ".";
> }
>
> // register tick function
> register_tick_function('checkUsage');
>
> // declare ticks
> declare(ticks = 1);
>
> for($i = 0; $i < 1000; $i++) {
> echo '|';
> }
>
> ?>
>
> If you execute this script, you can see, that php is doing some ticks
> before the for-loop passes by the first time. That's no problem - yet.
> If I execute the script immediately again, the ticks between the loop
> passes counting higher and higher. I need to wait about one minute
> till the output is as expected.
>
> Can someone explain that to me?
>
> Cheers,
>
> Cem
>
> P.S.: I'm sorry for my poor english


Hi,

Could it be that you run this script on a threaded webserver?
What webserver did you run this script on, and how is its PHP installed?
(eg CGI, ISAPI, etc)

I ask this because:

Citation:
Warning: 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.
From:
http://nl.php.net/manual/en/function...k-function.php

Personally I would avoid all these tick functions totally. :-)

Regards,
Erwin Moller
  Réponse avec citation
Vieux 27/03/2008, 11h57   #3
actioncem@googlemail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: confused by php ticks

On 26 Mrz., 17:22, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.com> wrote:
> action...@googlemail.com schreef:
>
>
>
> > I am discovering some really weird behaviour of php while using ticks
> > and register_tick_function(). I've already searched the web and some
> > newsgroups, but I didn't find any suitable postings for my problem.

>
> > Here comes an example script:

>
> > <?php

>
> > // define tick function
> > function checkUsage() {
> > echo ".";
> > }

>
> > // register tick function
> > register_tick_function('checkUsage');

>
> > // declare ticks
> > declare(ticks = 1);

>
> > for($i = 0; $i < 1000; $i++) {
> > echo '|';
> > }

>
> > ?>

>
> > If you execute this script, you can see, that php is doing some ticks
> > before the for-loop passes by the first time. That's no problem - yet.
> > If I execute the script immediately again, the ticks between the loop
> > passes counting higher and higher. I need to wait about one minute
> > till the output is as expected.

>
> > Can someone explain that to me?

>
> > Cheers,

>
> > Cem

>
> > P.S.: I'm sorry for my poor english

>
> Hi,
>
> Could it be that you run this script on a threaded webserver?
> What webserver did you run this script on, and how is its PHP installed?
> (eg CGI, ISAPI, etc)
>
> I ask this because:
>
>
Citation:
> Warning: 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.
>
>
> From:http://nl.php.net/manual/en/function...k-function.php
>
> Personally I would avoid all these tick functions totally. :-)
>
> Regards,
> Erwin Moller


Hi,

I run this script on a Virtuozzo VM with Linux. It's a common apache
(apache 1, not 2) installation with PHP as module.

I must confess that I do not really understand the warning in the
documentation. What is a threaded web server module? What is that ZTS
mode? Anyway, same procedere when I execute the script on the command
line.

(BTW: If I execute the script in a Windowx XAMPP environment, apache
crashes).

Cheers,

Cem
  Réponse avec citation
Vieux 27/03/2008, 12h00   #4
actioncem@googlemail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: confused by php ticks

On 26 Mrz., 17:22, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.com> wrote:
> action...@googlemail.com schreef:
>
>
>
> > I am discovering some really weird behaviour of php while using ticks
> > and register_tick_function(). I've already searched the web and some
> > newsgroups, but I didn't find any suitable postings for my problem.

>
> > Here comes an example script:

>
> > <?php

>
> > // define tick function
> > function checkUsage() {
> > echo ".";
> > }

>
> > // register tick function
> > register_tick_function('checkUsage');

>
> > // declare ticks
> > declare(ticks = 1);

>
> > for($i = 0; $i < 1000; $i++) {
> > echo '|';
> > }

>
> > ?>

>
> > If you execute this script, you can see, that php is doing some ticks
> > before the for-loop passes by the first time. That's no problem - yet.
> > If I execute the script immediately again, the ticks between the loop
> > passes counting higher and higher. I need to wait about one minute
> > till the output is as expected.

>
> > Can someone explain that to me?

>
> > Cheers,

>
> > Cem

>
> > P.S.: I'm sorry for my poor english

>
> Hi,
>
> Could it be that you run this script on a threaded webserver?
> What webserver did you run this script on, and how is its PHP installed?
> (eg CGI, ISAPI, etc)
>
> I ask this because:
>
>
Citation:
> Warning: 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.
>
>
> From:http://nl.php.net/manual/en/function...k-function.php
>
> Personally I would avoid all these tick functions totally. :-)
>
> Regards,
> Erwin Moller


Addition: I do NOT run a threaded webserver - as our system engineer
told me right now
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h22.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12644 seconds with 12 queries