[英]Run shell script from website
I need to run shell a script from a php-powered website. 我需要从php驱动的网站运行shell脚本。 I set execution rights on my script. 我在脚本上设置了执行权限。
chmod +x AppRaspberry.exe
This is my script. 这是我的剧本。
#!/bin/bash
/home/pi/program/Debug/AppRaspberry.exe start
My website and c# application is on raspberry pi 3. The idea of everything is when user is ready with configuration on his settings to run c# application and it reads user settings from MySQL database. 我的网站和c#应用程序位于raspberry pi 3上。一切的想法是,当用户准备好配置其配置以运行c#应用程序时,它会从MySQL数据库读取用户设置。 I use this code to run script but it doesn't work, so tried with shell exec but my php don't recognize this method. 我使用此代码运行脚本,但是它不起作用,因此尝试使用shell exec,但我的php无法识别此方法。
if (!empty($_POST['start']))
{
exec("/home/pi/script/start.sh");
}
是shell_exec而不是schell_exec
Backtick operator works the same as shell_exec function, but saving some typing: chmod 666 file.txt
Backtick运算符的功能与shell_exec函数相同,但是保存了一些键入内容: chmod 666 file.txt
(note that that's backtick character and not single quotes) (请注意,这是反引号,而不是单引号)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.