Re: PHP Script/Thread ID thingie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 15, 2008 at 11:37 AM,  <ceo@xxxxxxxxx> wrote:
>
> I'm logging things with error_log, and would like to be able to sort out one script run from another.
>
> So I'm looking for some kind of "script id" or "thread id" or "PHP script run execution ID" type of function.
>
> getmypid() just returns the same apache child process ID all the time, so that's not what I want.
>
> zend_thread_id() looks useful, but I suspect it's not quite what I'm looking for.  But I'd have to re-compile with ZTS and --debug-mode and I don't think the function I'm looking for should require that...
>
> Perhaps I've just missed the right function name?
>
> Or perhaps this should be a "Feature Request"?


I suppose if nobody else has better ideas you can fake it with setting
some sort of unique value and combining that with __FILE__ for your
instance run.

<?php
$GLOBALS['instance'] = md5(uniqid());
error_log(__FILE__.$GLOBALS['instance'].'  first log');
error_log(__FILE__.$GLOBALS['instance'].' second log');
?>

Not very glamorous though. ;)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux