我想安装通过命令行(linux OS)可访问的小程序到服务器并使用PHP运行它们。 我想在我的机器上安装Apache,vhost ...... 有没有办法在我的虚拟服务器上运行这些外部应用程序,在我的系统上,所以我可以尝试PHP调用?
答案 0 :(得分:2)
我们一直这样做。我把它们称为伏都教页面。这是一些有效的代码:
<?php
$command="uptime"; $output; $retval; $errors="";
exec ( $command , &$output, &$retval );
echo $output[0]."\n";
unset($output);
?>
输出到网页:
13:40:19 up 22 days, 23:14, 0 users, load average: 0.04, 0.02, 0.00
答案 1 :(得分:0)
你可以编写一些shell脚本* .sh,然后打开应用程序。 你可以使用php命令“shell_exec”并运行这些shell脚本。