note 37258 deleted from function.exec by danbrown

From: Date: Sun, 04 Jan 2009 16:32:38 +0000
Subject: note 37258 deleted from function.exec by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148813@lists.php.net to get a copy of this message
Note Submitter: camusatan at yahoo dot com ---- I tried forever to figure out how to invoke a background process, _then_ get its PID so that I can later check on it. On Linux (with /bin/sh equalling /bin/bash), the following finally worked: $shell_results= exec("wget -O - \"$myurl\" &>/dev/null & echo \$!", $results,$status); The command I'm invoking is 'wget', and $shell_results will end up with the PID of the background wget process. The $results and $status variables I mostly just used for troubleshooting and getting this line working. I put a backslash in front of the dollar sign to keep PHP from trying to interpret it as a variable.

« previous php.notes (#148813) next »