0

I am having trouble getting a file to execute without typing sudo before it. I think the problem is the libraries I used require you to be a superuser.

I am working on a program for the Raspberry Pi and so far everything has worked great. The program takes a command line argument and outputs it to a separate 2x16 LCD. So if I type the following command as root or place sudo in front of it the program functions as intended:./serialTest Hello World.

What I am working on now is getting the value of a text box on a PHP webpage and submitting it to the program as a command line argument using the exec() function in PHP The problem is that I am unable to execute it because unless I am root I have tried exec("sudo ./serialTest" . $textBox); but it still tells me Permission Denied

After further reading into the libraries I am using I cam across instructions on how to execute the serialOpen function without using sudo or being root I have added the user pi and www-data to the dialout group I have verified this with id pi id www-data. The program still says Permission denied. Is there something I could look at further or am I doing something wrong? I have included the excerpt from the page that states how to run it without using sudo or being root

You can use it without sudo if you add yourself into the dialout group. either edit /etc/group, or use the usermod command. (and logout/login again)
-Gordon
4

1 回答 1

1

这取决于服务器服务提供者提供的服务器权限。如果您是服务证明者,则编辑 Shell 访问权限以在 PHP 配置文件中执行 Exec 命令。默认情况下,默认情况下不提供 exec 这就是消息来的原因

如果您不是服务提供商,请联系他们做事..

于 2013-03-01T05:12:20.370 回答