Re: PHP equivalent to Perl $0

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

 



Richard Luckhurst wrote:
Hi Richard,


RL> And, frankly, why would you want to do that?  It only sows confusion
RL> in ps output. :-)

Unless you're talking about apps spawned by inetd and its cousins. ps shows the name as specified in arguments in the inetd.conf file, not the name of the executable, which often prefixed by "in." , to indicate it's supposed to be spawned by inetd.

It seems to me that whoever wrote the specification had this thing about ps
showing a nice string instead of the program name actually running. Of course I
know that this is what ps is supposed to do and Perl allows you to tell nice
lies to ps :-)

As does C, C++, and a host of other languages. PHP does not - even though there's no error when you stuff a CLI php's $argv[0] with a different name:
#!/usr/local/bin/php
<?php
$argv[0]="whatever";
sleep(20);
?>

./qq.php &

ps

20232 pts/0    00:00:00 qq.php

--
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