0

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?

1

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

6 Comments

Thanks for response, I have downloaded the php_ssh2-0.11.2-5.3-vc9-x86.zip and extracted to the ext folder in php. Then added to php.ini, I have restarted easyphp but still the same error message
Make sure you use php.ini-development (rename it to php.ini). You should aspire at becoming a professional, and professionals don't use "easyphp" or similar do-nothing understand-nothing approaches. Learn how it works by installing and configuring apache and PHP individually: news.softpedia.com/news/…. If you do it properly, PHP will at least give you hints on what is wrong.
I have already php.ini file. I don't see the reason to install everything manually, I want just to run a command shell remotely from php.
As I said: Make sure you use php.ini-development (rename it to php.ini), and PHP will at least give you hints on what could be wrong.
See my edited answer. You should however really aspire at becoming a professional, who never says "but I don't want to learn, I want to get it work". The reality is: you get it working WITH KNOWLEDGE.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.