简体   繁体   English

从php远程执行命令shell

[英]Execute command shell from php Remotely

I was trying to get result from shell in a remote machine in my web page using php. 我试图使用php在我的网页中的远程计算机上从shell中获取结果。 I used these lines: 我使用了以下几行:

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

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

I am trying to get result in my web page in windows machine and libssh2 is already included in easyphp . 我试图在Windows机器的网页中获取结果,并且libssh2已经包含在easyphp中。 but the same message: 但相同的消息:

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

Any idea? 任何想法?

You have to download and install the PECL extension for SSH2 from the Microsoft delegate to the PHP project: http://downloads.php.net/pierre/ . 您必须从Microsoft委托下载并安装SSH2的PECL扩展,并将其安装到PHP项目: http : //downloads.php.net/pierre/

To see any errors in your applications and in the configuration of your environment, make the values of the following configuration directives look like this: 要查看您的应用程序和环境配置中的任何错误,请使以下配置指令的值如下所示:

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