使用 azure cli 的 php exec 命令始终返回 null
在运行 PHP 的 Apache 服务器上,我有一个始终返回 null 的命令。
exec("az 存储容器存在 --account-name $accountName --account-key $key --name $containeurName", $output);
我修改了 sudoers 文件,但它没有改变任何内容:
www-data ALL=(ALL) NOPASSWD: /usr/bin/az
感谢您的帮助。
On a server Apache which runs PHP, I have a command which always return null.
exec("az storage container exists --account-name $accountName
--account-key $key --name $containeurName", $output);
I modified the sudoers file but it didn't change anything:
www-data ALL=(ALL) NOPASSWD: /usr/bin/az
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
exec($your_command, $output, $error_code)
并查看$error_code
包含什么内容。这可能只是因为az
不在 PHP 的 PATH 环境变量中。尝试输入可执行文件的完整路径,通常如下所示:
Use
exec($your_command, $output, $error_code)
and see what$error_code
contains. It may just be becauseaz
isn't in the PATH env variable in PHP.Try to put the full path to your executable, typically something like this: