so have small php-snippet, makes use of exec function. in example, run code:
// bit setup before, not relevant $jobs = count($redis->keys('*')); // outputs 10 if job-amount reached if($jobs == 10) { exec("/usr/src/gx/examples/cpp/cpd/cpd01.out > /dev/null 2>&1 &"); } first of all: know, don't have separate them, knowledge in c++ isn't deep , don't want change code, since 3rd party lib.
for reason, php script doesn't run after reaching 10 jobs. can tell, c++ script called, seems never comes php.
i found similar threads , questions, nothing far helped
the c++ code shouldn't relevant, think. added nevertheless.
in shell, run command ./ or calling full path: /usr/src/ex/examples/cpp/cpd/cpd01.out , works fine.
any ideas?
// update 1
i extended code this:
exec("/usr/src/gx/examples/cpp/cpd/cpd01.out > /dev/null 2>&1 &", $array, $status ); $redis->flushdb(); fwrite($fp, $status . "\n"); fwrite($fp, "------------\n"); fwrite($fp, print_r($array)); and comes out:
0 ------------ 10 ------------ 10 ------------ 10 ------------ 1 also, use chown cpd01.out-file www-data:www-data
first of all, user (the 1 runs script, www-data if apache) have permissions run it?
if define second parameter return array output debugging purposes , third argument exit status of command (http://php.net/manual/en/function.exec.php).
if($jobs == 10) { exec("/usr/src/gx/examples/cpp/cpd/cpd01.out 2>&1", $array, $status); echo $status . "\n"; var_dump($array); }
Comments
Post a Comment