Description:
------------
With linux it is sometimes useful to be able to change the process name (by identifying a process in the system error logs or for debugging for example)..
The c(++) or the perl way doesnt work in php as far as i tried, and so i pressume that it is not possible itself.
You can consult yourself with http://lightconsulting.com/~thalakan/process-title-notes.html - an extensive example of how the title should be changed
Reproduce code:
---------------
$argv[0] = "progname-debugval";
Expected result:
----------------
I expect that the programs process title would be changed by modifying $argv[0], or by introducing a new function which would change the process title respectively.
Actual result:
--------------
The process name in `ps` output of the respective program should change accordingly to the change of $argv[0];

Patches

Pull Requests

History

setproctitle() is only implemented on BSD; other systems that emulate this use a non-portable dangerous hack that makes certain assumptions about how the process will be run.
Suspending until this situation changes.

This would be a very nice feature. Using perl you can change $0 variable. PHP do lack this functionality.
---From perlvar doc-----
$0 Contains the name of the program being executed.
On some (read: not all) operating systems assigning to $0 modifies the argument area that the "ps" program sees. On some platforms you may have to use special "ps" options or a different "ps" to see the changes.
Modifying the $0 is more useful as a way of indicating the current program state than it is for hiding the program you're running. (Mnemonic: same as sh and ksh.)
Note that there are platform specific limitations on the the maximum length of $0. In the most extreme case it may be limited to the space occupied by the original $0.
In some platforms there may be arbitrary amount of padding, for example space characters, after the modified name as shown by "ps". In some platforms this padding may extend all the way to the original length of the argument area, no matter what you do (this is the case for example with Linux 2.2).
Note for BSD users: setting $0 does not completely remove "perl" from the ps(1) output. For example, setting $0 to "foobar" may result in "perl: foobar (perl)" (whether both the "perl: " prefix and the " (perl)" suffix are shown depends on your exact BSD variant and version). This is an operating system feature, Perl cannot help it.
In multithreaded scripts Perl coordinates the threads so that any thread may modify its copy of the $0 and the change becomes visible to ps(1) (assuming the operating system plays along). Note that the the view of $0 the other threads have will not change since they have their own copies of it.
---------------------------
Regards.
Daniel
<a href="http://www.xcomprar.com/">venda</a>

Just for info since a lot of people seems to be looking for this kind of solution (I'm one of them), I've hosted the proctitle extension on a SVN repository, updated and fixed.
Available at:
http://ookoo.org/svn/proctitle/
Please let me know if you want to add things to this extension. I tested it with PHP 5.2.8 and PHP 5.3.0alpha3, without problems.