使用 php 执行 powershell 脚本时挂起
hangs when execute powershell script using php
当尝试使用 $out = shell_exec('powershell.exe -command C:\xampp\htdocs\web\ping.ps1 < NUL');
echo $out;
运行 powershell 脚本时
它挂起并注意到已完成,页面继续加载,
这是我的简单脚本
ping 8.8.8.8 -t
我在 powershell 中使用了这个命令,以便首先允许执行脚本,
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
但没有任何变化。
我需要帮助,如何使用 php 执行 powershell 脚本?
发生这种情况是因为标记 -t 为命令提示符提供了继续 ping 直到被中断的命令。
持续加载是 php 执行 power shell 脚本并等待所述脚本停止执行后再继续。因为您的强大 shell 脚本在您离开该页面之前永远不会停止。它会不断加载
因此,中断将是 php 内存用完并出现故障。或者用户离开停止执行的页面。请查看
我建议使用计数然后在执行后捕获输入
当尝试使用 $out = shell_exec('powershell.exe -command C:\xampp\htdocs\web\ping.ps1 < NUL');
echo $out;
它挂起并注意到已完成,页面继续加载, 这是我的简单脚本
ping 8.8.8.8 -t
我在 powershell 中使用了这个命令,以便首先允许执行脚本,
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
但没有任何变化。 我需要帮助,如何使用 php 执行 powershell 脚本?
发生这种情况是因为标记 -t 为命令提示符提供了继续 ping 直到被中断的命令。
持续加载是 php 执行 power shell 脚本并等待所述脚本停止执行后再继续。因为您的强大 shell 脚本在您离开该页面之前永远不会停止。它会不断加载
因此,中断将是 php 内存用完并出现故障。或者用户离开停止执行的页面。请查看
我建议使用计数然后在执行后捕获输入