[英]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.