[英]Linux uptime command inside php doesn't show anything
我正在尝试以下服务器上的php文件中的linux命令正常运行时间
<p> The uptime for this system is <?php $up_time=shell_exec('uptime');
echo $uptime; ?</p>
但是当我打开网页时,它只显示:
The uptime for this system is
PHP似乎没有运行该命令。 如果我进入命令提示符并运行正常运行时间,则可以看到结果。
我正在将ssh放入Linux网络服务器。 php文件位于服务器上的我的文件夹中。
我认为以下代码将起作用。
The uptime for this system is <?php passthru('/usr/bin/uptime'); ?>
在php中执行系统命令,建议您始终提供命令的完整路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.