0

Need some help here. I have a c++ library for communicating with an embedded module (ArchLinux) via tty. This library was compiled/converted into php using swig.

The issue now is that a sample program written in php and run from the command line executes as expected but when this same code is used as part of a web page's functionality it fails to execute.

My assumption based on my limited linux knowledge is that tty requires a console in order to run which is why it fails to run as part of a webpage??

Does anyone have any ideas as to how I can get this to work? I have read something about using posix_ttyname but I cant seem to find any code samples that demonstrate its use.

I have attached the offending c++ files along with a test main.php which works for review.

Thanks everyone

http://www.mediafire.com/?ctblcvsy86mdg8p

4

1 回答 1

0

$argv仅当从 CLI 调用脚本时变量才可用。如果您不想更改脚本以便可以从网络调用它,您可以尝试从另一个脚本调用它

exec('main.php param');

就像你从命令行做的一样。

于 2011-08-31T04:00:58.937 回答