php exec()命令不在apache Windows中执行

发布于 2025-01-25 09:38:41 字数 374 浏览 2 评论 0原文

我正在尝试运行php exec()命令,但是它没有执行。它在NGINX上起作用,但在Apache上不起作用。我正在使用Windows。

$cmdex = exec('cmd /c C:\nginx-1.20.2\html\pythonbatch.bat');
echo $cmdex;

我尝试了不同的解决方案,例如更改权限和配置文件,但它不起作用。当我运行PHP程序时,它会输出此功能,但不会执行:

C:\Apache24\htdocs>exit

PHP通常可以正常工作,但是当我做任何与执行有关的事情时,它无效。

编辑:要澄清,PHP在执行命令独立时可以工作,但在浏览器中不起作用。

I'm trying to run the PHP exec() command, but it doesn't execute. It works on NGINX but doesn't work on Apache. I'm using Windows.

$cmdex = exec('cmd /c C:\nginx-1.20.2\html\pythonbatch.bat');
echo $cmdex;

I've tried different solutions like changing the permission and config files, but it doesn't work. When I run the PHP program, it outputs this but doesn't execute:

C:\Apache24\htdocs>exit

PHP works fine in general, but when I do anything that has to do with executing, it doesn't work.

EDIT: To clarify, PHP works when executing the command standalone but doesn't work in browser.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文