0

I am trying to call an exe from php. the exe is created from Qt. It runs in Qt as well as from the command line but when I try to run it from php I get incomplete output. The exe takes around 5-7sec to run.

The output that I get from command line is:

--(!)Error loading
--(!)Error loading
1
2
3
4
5

I am not sure what the error loading is for but it stills run the exe and gives the output. But when I run it from php I get

array(2) { [0]=> string(18) "--(!)Error loading" [1]=> string(18) "--(!)Error loading" }

After Error loading it takes abit time in the command line to give the output so may be the php does not wait for it to complete. I am not sure. How can I find out what the error is and how can I solve this? The php script that I am using to call the exe is:

<?php
   $addr="/home/ggt/project/build-test-Desktop-Release/test";
  exec($addr,$data);
  var_dump($data);

?>

I tried using shell_script too. But it does not work. I even inserted a sleep(20) after exec but still its the same.

4

1 回答 1

0

我解决了这个问题......这是因为代码中有一个 imshow() 我错过了注释掉。因此,它没有执行整个程序并停止它。删除 imshow 后,我能够获得所有输出。

于 2013-11-11T03:19:05.050 回答