Note that this extension is considered buggy. See https://wiki.php.net/rfc/cli_process_title, which says:
"...but it is incomplete and might lead to memory corruption on Linux (or any OS which does not support setproctitle.
The reason is the extension only has access to original argv[0] (that comes from main()). argv and environ(7) are in contiguous memory space on Linux. The extension presumes that argv[0] can accomodate 128 characters, but usually that is not possible because argv[0] is “php”. When this happens, the extension will scribble on argv[1], argv[2], etc., and maybe even environ and this can have destructive side effects on the running program."
setproctitle
(PECL proctitle >= 0.1.0)
setproctitle — Establecer el título de proceso
Descripción
void setproctitle
( string
$title
)Establece el título de proceso del proceso actual.
Parámetros
-
title -
El título que se utilizará como título de proceso.
Valores devueltos
No devuelve ningún valor.
Ejemplos
Ejemplo #1 setproctitle() ejemplo
Ejecutar el siguiente ejemplo va a cambiar el título de proceso (visible con ps a, por ejemplo).
<?php
setproctitle("myscript");
?>
El resultado del ejemplo sería algo similar a:
$ ps a PID TTY STAT TIME COMMAND 1168 pts/3 S 0:00 myscript
Ver también
- pcntl_fork() - Forks the currently running process
- setthreadtitle() - Set the thread title
zodbd421 at gmail dot com ¶
28 days ago
