簡體   English   中英

從php遠程執行命令shell

[英]Execute command shell from php Remotely

我試圖使用php在我的網頁中的遠程計算機上從shell中獲取結果。 我使用了以下幾行:

<?php
$connection = ssh2_connect('192.168.10.10', 22);
ssh2_auth_password($connection, 'username', 'password');

$stream = ssh2_exec($connection, 'whoami');
?>

我試圖在Windows機器的網頁中獲取結果,並且libssh2已經包含在easyphp中。 但相同的消息:

Fatal error: Call to undefined function ssh2_connect() in C:\Program Files (x86)\EasyPHP-5.3.8.0\www\testphp_ssh.php 

任何想法?

您必須從Microsoft委托下載並安裝SSH2的PECL擴展,並將其安裝到PHP項目: http : //downloads.php.net/pierre/

要查看您的應用程序和環境配置中的任何錯誤,請使以下配置指令的值如下所示:

error_reporting = E_ALL|E_STRICT
display_errors = On
short_open_tag = Off
asp_tags = Off
display_startup_errors = On

output_buffering = Off
allow_call_time_pass_reference = Off
zlib.output_compression = Off
track_errors = On
register_globals = Off
session.auto_start = 0
tidy.clean_output = Off

implicit_flush = Off
log_errors = On
ignore_repeated_errors = On
report_memleaks = On

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM