[英]Communicate between Shell and PHP?
im going to write a php script that should do the following: 我要写一个PHP脚本,应该执行以下操作:
i don't want to use default www-data user for that - how can i exec the cmd with another user? 我不想为此使用默认的www-data用户-我如何与另一个用户执行cmd?
Whats the best way to do that with PHP on Debian/Ubuntu ? 在Debian / Ubuntu上用PHP做到这一点的最佳方法是什么?
Maybe run a .sh file (+ params) with shell_exec()
? 也许使用
shell_exec()
运行.sh文件(+参数shell_exec()
?
Depending upon your need you can use .sh
as well exec
too 根据您的需要,您也可以使用
.sh
以及exec
If you have lots of commands under single action then you should prefer shell script 如果您在一次操作中有很多命令,那么您应该使用shell脚本
For one liners shell_exec
works efficiently. 对于一个内衬,
shell_exec
有效地工作。
For more reference (regarding syntax) visit Documentation 有关更多参考(关于语法),请访问文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.