exe not giving output in php

不打扰是莪最后的温柔 提交于 2019-12-11 21:59:56

问题


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.


回答1:


I solved the problem...It was because there was an imshow() in the code which I missed to comment out. So, it did not execute the whole program and stopped it. After I removed the imshow I was able to get all the output.



来源:https://stackoverflow.com/questions/19854746/exe-not-giving-output-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!