Edit report at http://bugs.php.net/bug.php?id=34570&edit=1
ID: 34570 Updated by: dtajchre...@php.net Reported by: steve-php-dev at spwiz dot com Summary: Implement some sort of setproctitle() in cli version Status: Open Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: Linux 2.4 kernel PHP Version: 5.0.5 Block user comment: N Private report: N New Comment: http://pecl.php.net/package/proctitle Previous Comments: ------------------------------------------------------------------------ [2011-01-23 01:48:45] matt at mralston dot co dot uk I can't stress how much I'd like to see this feature implemented. I'm not a C programmer and I haven't got a clue how PHP is structured behind the scenes, but I can't imagine that this feature would be difficult to implement. I've been through a quite a journey with this conundrum today. I started out coding a new daemon this morning. Began to wish I could change the "/usr/bin/php ./caiman.php start" entry in the "ps auxw" listing this afternoon. I then spent some time researching how to do it (which was fustrating because I didn't even know how to phrase the question for Google when I started). I eventually found some C++ forums talking about modifying argv[0] and was excited and then disappointed when I found it didn't work in PHP. I drafted out a long e-mail I intended to send to the PHP developers, then figured I'd better properly RTFM and check out the bug tracker first. That's when I came across this feature request (and an older one from 2002). Unfortunately both appear to have stalled. So here I am, adding my voice to this request. I can grovel if you like! Please, please, please would somebody have a go at adding this feature when they've got some spare time? Even if the feature is ultimately rejected for inclusion into the trunk, a little patch that I could apply to my own servers would be appreciated so much. In the meantime, I'm just about to start poking around the PHP sources on my development box and see if I can implement something myself. As I said, I'm not a C programmer so I expect to struggle, but it's worth a shot. I'm thinking of something like: void pcntl_setproctitle(char *new_title) { sprintf(argv[0], new_title); } Thanks for listening to me ramble. - Matt ------------------------------------------------------------------------ [2005-09-20 23:39:12] steve-php-dev at spwiz dot com Description: ------------ I'm using the pcntl module in the CLI SAPI to fork off several processes. I'd like the processes to be able to identify themselves in ps. In Linux, you can do this by editing argv[0]. On BSD, you use the setproctitle() function. Other higher level languages support this feature. A simple perl script to do this on Linux would be: $0 = "bogus"; sleep 10; I tried modifying $argv[0], but that only modified the PHP scripts copy of argv, not the real argv. It'd be nice if there was a way to modify the process title directly. Ideally, it would be cross-platform (for Unix variants, at least). This was originally requested in 2002 (http://bugs.php.net/bug.php?id=18400), but was rejected. When using the pcntl functions in the CLI version, it really would be a useful feature. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=34570&edit=1