doulaopu2343 2010-06-27 20:35 采纳率: 100%
浏览 159

从PHP脚本运行控制台应用程序

i start a linux console app from my php5 script, it starts ok but then termintates. I've tried using system(), shell_exec and tried starting as background process but to no avail it starts and then quits.

What i am trying to achieve is from a remote browser start a console app using a php5 script and then it should remain running (just as it would if i started it from a bash shell) , i then want to send commands (from a bash shell it would be keyboard strokes) to the console app from another set of php5 scripts. Hope its clear what i am trying to do.

If anyone could give some info on the best way about doing this, as i think i may have something fundamentally wrong. I have a Debian Lenny box running apache.The console app is just a simple program that prints to stdout and reads from stdin.

  • 写回答

2条回答 默认 最新

  • dswqz24846 2010-06-27 21:14
    关注

    How do you expect to send input to this app? Where is it listening for input?

    It simply may only support interactive use, and exit as a result of that. Or, even simpler, it may terminate because it sees that is has no input (nothing piped in or nothing from some file) and since it's not connected to an interactive shell, it has nothing to do. There's no point in waiting for input from a user that doesn't have a way to interact w/ the application.

    评论

报告相同问题?

悬赏问题

  • ¥15 变数的长度不一样”。是什么原因呢?如何修改?
  • ¥15 matlab作业不会写
  • ¥15 vue2(标签-chrome|关键词-浏览器兼容)
  • ¥15 python网络流自动生成系统 医学领域
  • ¥15 sql查询仓库里都有什么
  • ¥15 代码的修改,添加和运行完善
  • ¥15 krpano-场景分组和自定义地图分组
  • ¥15 lammps Gpu加速出错
  • ¥15 关于PLUS模型中kapaa值的问题
  • ¥15 关于博途V17进行仿真时无法建立连接问题