downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

posix_setuid> <posix_setpgid
[edit] Last updated: Fri, 24 May 2013

view this page in

posix_setsid

(PHP 4, PHP 5)

posix_setsidFait du processus courant un chef de session

Description

int posix_setsid ( void )

Fait du processus courant un chef de session.

Valeurs de retour

Retourne l'identifiant de session, ou -1 si une erreur survient.

Voir aussi

  • Reportez-vous à POSIX.1 et setsid(2) dans le manuel de votre système POSIX pour plus d'informations sur le contrôle de tâche.



add a note add a note User Contributed Notes posix_setsid - [1 notes]
up
0
karlsson dot nicklas at gmail dot com
5 years ago
Very useful when making daemons, for example:

<?php
    $pid
= pcntl_fork(); // fork
   
if ($pid < 0)
        exit;
    else if (
$pid) // parent
       
exit;
    else {
// child
   
       
$sid = posix_setsid();
       
        if (
$sid < 0)
            exit;
           
        for(
$i = 0; $i <= 60; $i++) { // do something for 5 minutes
           
sleep(5);
        }
    }
?>

 
show source | credits | sitemap | contact | advertising | mirror sites