简体   繁体   English

无法从树莓派2 ver B中的php脚本运行sudo killall python

[英]Failed to run sudo killall python from php script in raspberry pi 2 ver B

i run script python from php in my raspberry pi and i wanna stop the program. 我在树莓派中从php运行脚本python,我想停止程序。

when i run program with php is running perfectly but when i run another file php to stop the program i failed. 当我用php运行程序时,它运行完美,但是当我运行另一个文件php以停止程序时,我失败了。

this my code to run file python using php 这是我的代码以使用php运行文件python

<?php
shell_exec("/usr/bin/python /home/pi/Documents/python_project/multiple.py");

this my code to stop program 这是我的代码停止程序

<?php
shell_exec("usr/bin/sudo killall python");
echo "kill executed"

thanks 谢谢

A few problems were identified 确定了一些问题

1) www-data may not be in your sudoers file, check it is present, if not, add the line 1)www-data可能不在您的sudoers文件中,检查它是否存在,如果不存在,请添加以下行

www-data ALL=(ALL) NOPASSWD: ALL

to the file. 到文件。

2) You are missing a "/" from the line "usr/bin/sudo", you should add it to be "/usr/bin/sudo" so the path is correct. 2)您在“ usr / bin / sudo”行中缺少“ /”,应将其添加为“ / usr / bin / sudo”,以便路径正确。 usr/bin/sudo does not exist. usr / bin / sudo不存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM