rfc:cli_process_title

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:cli_process_title [2013/02/19 06:09]
keyur Removing reference to 5.4
rfc:cli_process_title [2017/09/22 13:28] (current)
Line 1: Line 1:
 ====== Request for Comments: PHP CLI changing process title support ====== ====== Request for Comments: PHP CLI changing process title support ======
  
-  * Version: 1.1+  * Version: 1.3
   * Date: 2013-02-06   * Date: 2013-02-06
   * Author: Keyur Govande <kgovande@gmail.com>   * Author: Keyur Govande <kgovande@gmail.com>
-  * Status: Voting+  * Status: Implemented (in PHP 5.5)
   * First Published at: http://wiki.php.net/rfc/cli_process_title   * First Published at: http://wiki.php.net/rfc/cli_process_title
  
Line 28: Line 28:
    * On BSD without [[http://www.unix.com/man-page/FreeBSD/3/setproctitle/|setproctitle]] support: Similar to Linux. A deep copy of argv is made and returned to main() for further use. The original argv[0] is pointed to a 256 character array block into which the title is copied over. argv[1] is set to NULL to indicate the 'end' of the argv array.    * On BSD without [[http://www.unix.com/man-page/FreeBSD/3/setproctitle/|setproctitle]] support: Similar to Linux. A deep copy of argv is made and returned to main() for further use. The original argv[0] is pointed to a 256 character array block into which the title is copied over. argv[1] is set to NULL to indicate the 'end' of the argv array.
    * On systems with support for [[http://www.unix.com/man-page/FreeBSD/3/setproctitle/|setproctitle]] OR pstat PSTAT_SETCMD or PS_STRINGS, we use these instead.    * On systems with support for [[http://www.unix.com/man-page/FreeBSD/3/setproctitle/|setproctitle]] OR pstat PSTAT_SETCMD or PS_STRINGS, we use these instead.
-   * On Windows: the title is set as an Windows [[http://msdn.microsoft.com/en-us/library/windows/desktop/ms682396(v=vs.85).aspx|Event]]. It can be viewed using [[http://technet.microsoft.com/en-US/sysinternals/bb896653|Process Explorer]].+   * On Windows: the title is for the 'parent' console window using [[http://msdn.microsoft.com/en-us/library/windows/desktop/ms686050(v=vs.85).aspx|SetConsoleTitleset]]. It is visible on the parent window, and in TaskManager's Applications tab.
  
 Support for setting the title is also built into the cli-server SAPI. Support for setting the title is also built into the cli-server SAPI.
Line 45: Line 45:
  
 sleep(15); sleep(15);
 +echo cli_get_process_title() . "\n";
 </code> </code>
  
Line 51: Line 52:
   * Linux: {{:rfc:linux_ps_title.png?200|}}   * Linux: {{:rfc:linux_ps_title.png?200|}}
   * FreeBSD 9.0: {{:rfc:fbsd_ps_title.png?200|}}   * FreeBSD 9.0: {{:rfc:fbsd_ps_title.png?200|}}
-  * Windows 7: {{:rfc:windows_ps_title.png?200|}}+  * Windows 7: {{:rfc:windows_ps_title_console.png?200|}}
   * OS X Lion: {{:rfc:osx_ps_title.png?200|}}   * OS X Lion: {{:rfc:osx_ps_title.png?200|}}
 +
 +
 +===== Specification =====
 +
 +==== Description ====
 +
 +  bool cli_set_process_title(string $title)
 +
 +''cli_set_process_title()'' sets title of the process to //**title**// and returns TRUE if the operation succeeded. Or FALSE if it fails. On failure, a WARNING is emitted with details as to why it failed, the most common cause being the operating system is not supported.
 +
 +==== Parameters ====
 +
 +**title**
 +
 +==== Description ====
 +
 +  string cli_get_process_title()
 +
 +''cli_get_process_title()'' returns a string containing the title that was set using ''cli_set_process_title''
 +
 +Note that this returned string may not match what ps/top would show; for example on FreeBSD in ps, you would see the process name as "php: title (php)" where //**title**// is what was passed to ''cli_set_process_title''
 +
 +If the method fails for any reason, a WARNING is emitted and NULL is returned; the most common cause of failure being the operating system is not supported.
 +
 +==== Parameters ====
 +
 +None
  
 ===== Patch ===== ===== Patch =====
Line 63: Line 91:
 Voting ends March 4th, 2013. Voting ends March 4th, 2013.
  
-<doodle title="Accept modifying CLI process title in PHP?" auth="user" voteType="single" closed="false">+<doodle title="Accept modifying CLI process title in PHP?" auth="user" voteType="single" closed="true">
    * Yes    * Yes
    * No    * No
Line 72: Line 100:
   * 1.0 (2012-02-06): Initial draft   * 1.0 (2012-02-06): Initial draft
   * 1.1 (2012-02-07): Updated the introduction with more justification for why this is needed   * 1.1 (2012-02-07): Updated the introduction with more justification for why this is needed
 +  * 1.2 (2012-02-21): Added in method specifications
 +  * 1.3 (2012-02-26): Changed the Windows implementation from Events to SetConsoleTitle
rfc/cli_process_title.1361254160.txt.gz · Last modified: 2017/09/22 13:28 (external edit)