Reputation: 29
I have a working web php app. I'm working on win 7 and using apache.
Now I'm trying to execute this java command in php and display result on site:
exec("java -jar C:\webroot\ipt\themes\ipt\views\site\Skills.jar 5 10 5.5 10 2 5 8 3 10 6 11 2 15 4", $output);
for ($index = 0; $index < count($output); $index++) {
echo $output[$index]." ";
}
However $output is an empty array - no output. I'm not getting any error or crash. Output is only a basic string. I tried to enter this same command in cmd and it work as it should - returning expected output.
So I tried different command to see if it's not problem with exec(), so I tried 'ipconfig' which displayed output on site flawlesly.
Because of this I think it has something to do with either PHP or Apache (or both).
I searched for some similar problems of other people and tried:
So I want to ask if someone doesn't know solution to this problem.
Thanks
Upvotes: 2
Views: 3876
Reputation: 1770
Make sure that you are able to run this command without any problems in your console directly.
Change your exec
to the following:
exec("java -jar C:\\webroot\\ipt\\themes\\ipt\\views\\site\\Skills.jar 5 10 5.5 10 2 5 8 3 10 6 11 2 15 4 2>&1", $output);
Upvotes: 1