سؤال

I am trying to call Vowpal Wabbit and return the results to a php script and to a webpage;

$output = shell_exec('vw -i /root/house.model -t /root/house_dataset -p /dev/stdout --quiet');

When I echo the output:

echo $output;

It is empty, although when I run the script in the terminal it runs perfectly.

0.000018
0.282964
0.999793 second_house
0.282964
0.000128 third_house

When I do a var_dump on the $output in the php file, it returns NULL

هل كانت مفيدة؟

المحلول

You need to redirect standart output by adding 2>&1 at the end of the command.

shell_exec('vw -i /root/house.model -t /root/house_dataset -p /dev/stdout --quiet 2>&1')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top