skij
asked on
PHP: Getting the PID of a process running in the background
This PHP code runs the $cmd in the background. The response is written to the file $outputfile and the pid of the process is written to $pidfile.
exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile));
Instead of writing the $pidfile to a file, how can I access it in the PHP script? Can I access it as a variable instead of writing the result to a file?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.