note 35506 deleted from function.exec by cmb

From: Date: Sun, 24 Nov 2019 08:46:03 +0000
Subject: note 35506 deleted from function.exec by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213209@lists.php.net to get a copy of this message
Note Submitter: mauroi at digbang dot com ---- Well, after hours of fighting with output redirection, input redirection, error redirection, session_write_close (), blah blah blah, I think I found an easy way to execute a program in background. I used the following command: Proc_Close (Proc_Open ("./command --foo=1 &", Array (), $foo)); With the second argument you tell proc_open not to open any pipe to the new process, so you don't have to worry about anything. The third argument is only needed because it's not optional. Also, with the '&' operator the program runs in background so the control is returned to PHP as soon as Proc_Close is executed (it doesn't have to wait). In my case I don't use the user session in the executed script (there's no way it can be identified if it is not sended as a cookie or URL) so there's no need for session_write_close (correct me if I'm wrong with this). It worked for me.

« previous php.notes (#213209) next »