簡體   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