简体   繁体   中英

Execute command shell from php Remotely

I was trying to get result from shell in a remote machine in my web page using php. 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 . 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/ .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM