I'm using the PHP
exec() function to execute the Canu assembler programs, and I want to get its process ID within the same script.
The problem is
exec() not returning any PID, even the process is running successfully.
The processes are started like this:
$gnuplot_path = '/usr/bin/gnuplot'; $command = 'nohup canu -d . -p E.coli gnuplot='.$gnuplot_path.' genomeSize=4.8m useGrid=false maxThreads=30 -pacbio-raw /path/to/p6.25x.fastq > /path/to/process.err 2>&1 &';
Currently, I try to determine if the process is still running by:
$pid = exec($command, $output); var_dump($pid);
and also this:
exec($command, $pid, $return_var); print_r($pid); echo "$return_varn";
However, I got output of
string(0) "" and
Array ( ) 0 respectively.
Please let me know how to solve this. Thanks much.