PHP不会执行LinuxBash
我正在尝试执行一个html函数,该函数将使用一个php文件运行一个LinuxBash脚本并关闭一组无头虚拟机。bash脚本将自行成功运行,但php文件没有执行该脚本。我确保为sudoers添加正确的行PHP不会执行LinuxBash,php,html,bash,virtual-machine,Php,Html,Bash,Virtual Machine,我正在尝试执行一个html函数,该函数将使用一个php文件运行一个LinuxBash脚本并关闭一组无头虚拟机。bash脚本将自行成功运行,但php文件没有执行该脚本。我确保为sudoers添加正确的行 #!/bin/bash VM_NAME='wintgt1' VBoxManage controlvm $VM_NAME poweroff VM_NAME='wintgt2' VBoxManage controlvm $VM_NAME poweroff VM_NAME='wintgt3' VBo
#!/bin/bash
VM_NAME='wintgt1'
VBoxManage controlvm $VM_NAME poweroff
VM_NAME='wintgt2'
VBoxManage controlvm $VM_NAME poweroff
VM_NAME='wintgt3'
VBoxManage controlvm $VM_NAME poweroff
PHP
我还有其他脚本,它们的sudoers条目和php文件与这个脚本位于同一位置。但是,这个特定的php文件没有执行脚本。
谢谢我想
VBoxManage
需要sudo用户吗?哪个www-data
用户不是。看看你的另一个问题,同样适用。我能够解决我在上一个问题中遇到的问题。我对这个使用了相同的方法,但它不起作用。你能显示sudoers行www-data-ALL=(ALL:ALL)NOPASSWD:/etc/init.d/portstop.sh吗
<?php
shell_exec("sudo /etc/init.d/portstop.sh");
header("Location: http://192.168.1.21/mod/page/view.php?id=133&forceview$");
?>