试图执行从PHP用C编译的文件 [英] trying to execute file compiled in C from PHP

查看:216
本文介绍了试图执行从PHP用C编译的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得的文件我 C 写从 PHP 脚本执行。它没有响应,虽然我不是在所有得到任何错误。我可以用 ./ serialTest等等等等运行命令行就好了脚本和预期的结果是采取命令行参数,并将其输出到液晶屏其中工程真棒命令行。

I am trying to get a file I wrote in C to execute from a PHP script. It is not responding though I am not getting any errors at all. I can run the script from the command line just fine with ./serialTest Blah Blah and the intended result is to take the command line arguments and output them to an LCD screen which works awesome from the command line.

要得到它在<​​code> PHP 我使用 EXEC(./ serialTest运行$ inputField 的这个项目的目标是把他们投入从网页中的文本字段,这将使其出现在液晶屏上,他们可以看到他们通过现场摄像头饲料键入的内容。

To get it to run in PHP I am using exec("./serialTest " . $inputField the goal of this project is to take their input from a webpage in a text field and it will make it appear on the LCD screen and they can see what they typed via a live webcam feed.

该脚本不执行我有一个错误在我的code,或者这是不可能的?我想知道是否有这种替代,如果它不能以这种方式来完成。我意识到有可能是一些重大的安全威胁,允许这一点,但它仅仅是一个家庭服务器,我和一些朋友在一个有趣的项目。

The script is not executing do I have an error in my code or is this not possible? I would like to know if there is an alternative to this if it cant be done in this way. I realize there is probably some major security threat by allowing this but it is just a fun project on a home server for me and some friends.

推荐答案

有一件事你可以尝试:

exec("./serialTest   {$inputField}", $output, $status);
echo "status: " . $status;
echo "output: " . implode("\n", $output);

这篇关于试图执行从PHP用C编译的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆