Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell和PHP之间的通信?_Php_Shell_Debian_Exec_Wget - Fatal编程技术网

Shell和PHP之间的通信?

Shell和PHP之间的通信?,php,shell,debian,exec,wget,Php,Shell,Debian,Exec,Wget,我将编写一个php脚本,该脚本应执行以下操作: 创建用户 检查、下载和安装软件包 使用wget下载文件 移动文件 设置权限 使用屏幕启动应用程序 停止屏幕会话 我不想为此使用默认的www数据用户-如何与其他用户执行cmd 在Debian/Ubuntu上使用PHP实现这一点的最佳方法是什么 可能使用shell\u exec()?运行.sh文件(+params),根据需要,您也可以使用.sh以及exec 如果在单个操作下有很多命令,那么您应该更喜欢shell脚本 对于单行程序shell\u ex

我将编写一个php脚本,该脚本应执行以下操作:

  • 创建用户
  • 检查、下载和安装软件包
  • 使用wget下载文件
  • 移动文件
  • 设置权限
  • 使用屏幕启动应用程序
  • 停止屏幕会话
我不想为此使用默认的www数据用户-如何与其他用户执行cmd

在Debian/Ubuntu上使用PHP实现这一点的最佳方法是什么


可能使用
shell\u exec()

运行.sh文件(+params),根据需要,您也可以使用
.sh
以及
exec

如果在单个操作下有很多命令,那么您应该更喜欢shell脚本

对于单行程序
shell\u exec
而言,它的工作效率很高


有关更多参考(关于语法)的信息,请访问

谢谢!作为另一个用户(不是www-data e.x.)运行命令的最佳方式是什么?您需要在特定的文件夹/文件上执行chmod 777。因为该命令将作为“其他用户组”执行,所以您也可以使用jQuery执行。