Nik*_* K. 5 php command-line batch-file exec
我尝试在PHP中使用exec命令执行批处理文件.我只是用它:
$filename = 'test.bat';
exec($filename);
Run Code Online (Sandbox Code Playgroud)
但没有得到任何输出.我用另一个命令尝试了这个功能,它运行正常.您的建议将受到高度赞赏.谢谢
主要问题是path和permission.我已经让我的批处理文件执行了.
这是我的解决方案:
我从php文件所在的同一个文件夹中运行我的批处理文件.
exec("mybatch.bat");
I make sure that Apache Service has enough permission to run the batch file. Just to test i used an administrator account for Apache to log on with.