php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49586 argv variables reverse registration
Submitted: 2009-09-18 09:47 UTC Modified: 2010-11-24 14:34 UTC
Votes:6
Avg. Score:4.2 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:5 (100.0%)
From: michael dot schmidt at innogames dot de Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.3.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michael dot schmidt at innogames dot de
New email:
PHP Version: OS:

 

 [2009-09-18 09:47 UTC] michael dot schmidt at innogames dot de
Description:
------------
Sometimes i write php-cli Daemons who forks many different kind of childs. There is no way to identify this processes (e.g. by using ps or top ...)
If i change the argv varriable in my php-script, the argv varriables of the php-interpreter are untouched.

A solution would be a function which re-syncs the $argv from the php-script to the interpreter. This would change /proc/<pid>/cmdline and ps / top would display the given string.

Reproduce code:
---------------
<?php

$argv[1] = "BAR"; // Override argv

resyncargv(); // Requested function

?>


Expected result:
----------------
linux:~# ps ax
4030 ?        S      0:04 /usr/bin/php foo.php


Actual result:
--------------
linux:~# ps ax
4030 ?        S      0:04 /usr/bin/php BAR


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-22 04:54 UTC] just at another dot joe
Even better would be to make it so that $argv[1]="foo"; simply auto-updated, without the need to call a function, but I'd be quite happy with any update.
 [2010-11-24 14:34 UTC] jani@php.net
-Summary: argv Varriables reverse registration +Summary: argv variables reverse registration -Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2010-11-24 14:34 UTC] jani@php.net
http://www.steve.org.uk/Reference/Unix/faq_2.html#SEC22

Something like pcntl_exec() might work.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 15:01:36 2025 UTC