繁体   English   中英

PHP shell_exec() 无法运行节点

[英]PHP shell_exec() cannot Run Node

shell_exec()工作并为其他命令返回正确的结果。 例如shell_exec('ls -a')

但它不起作用,并且不会为shell_exec('node --version')shell_exec('/usr/bin/node --version')返回任何内容。

我实际上想从 PHP 运行一个简单的节点脚本,但我什至无法运行节点 cli。

我在 Ubuntu 16.04 上使用 Node 4.2.6(从官方仓库安装)和 XAMPP for Linux 5.6.12。

请问有什么想法吗? 我需要为某些东西设置一些权限吗?

<?php
session_start();
error_reporting(E_ALL);
ini_set("display_errors", 1);

?>

<!DOCTYPE html>
<html>
<head>    
</head>
<body>
<h2>Node Version</h2>
<?php
$output = shell_exec("node -v");
echo "<pre>$output</pre>";
?>
</body>

</html>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM