开发者

TTY ,SWIG and PHP

开发者 https://www.devze.com 2023-04-01 08:53 出处:网络
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.

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 exe开发者_开发问答cutes 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


$argv variable is available only when script is called from CLI. If you don't want to change the script so it could be called from web, you can try calling it from another script as

exec('main.php param');

Just like you do from command line.

0

精彩评论

暂无评论...
验证码 换一张
取 消