【问题标题】:php exec() returning 127 error where command running in terminal working finephp exec() 返回 127 错误,其中命令在终端中运行正常
【发布时间】:2018-08-16 10:21:38
【问题描述】:

我试图在我的服务器上运行此代码

exec("node -v", $out, $err);

echo "<pre>";
print_r($out);
print_r($err);

它只返回 127。但是 npm、node js 都安装在我的服务器上。 即使我尝试在终端中运行 node -v ,它也会返回版本。

请提出可能是什么问题。

【问题讨论】:

标签: php node.js terminal exec


【解决方案1】:

已解决:

我用过这个解决方案

exec("../../bin/node -v", $out, $err);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多