Connection closed by server!!!

Get help with using the PHP Secure Communications Library.

Moderator: Nuxius

Forum rules
The purpose of this forum is to provide support for phpseclib, a pure PHP SSH / SFTP / RSA library.

Posts by new users are held in a moderation queue and are not publicly visible until the post is approved.

Connection closed by server!!!

Postby astro.alireza » Sat Jun 23, 2012 3:13 pm

Hi everybody!
I use a whmcs module which control VPS from ssh (with help of phpseclib)
This module worked fine til I transfer my website from DirectAdmin to cPanel.
Now I get this error and I don't know why:
Code: Select all
Fatal error: Connection closed by server in /home/username/public_html/clients/modules/servers/w3esxi/libs/Net/SSH2.php on line 1325

I think there is a configuration problem in cpanel that cause this error.
Please help me.
Thanks!
astro.alireza
Traveler
 
Posts: 2
Joined: Sat Jun 23, 2012 3:05 pm

Re: Connection closed by server!!!

Postby TerraFrost » Sat Jun 23, 2012 10:27 pm

What does $ssh->getLastError() say?
TerraFrost
Legendary Guard
 
Posts: 12218
Joined: Wed Dec 04, 2002 6:37 am

Re: Connection closed by server!!!

Postby astro.alireza » Sun Jun 24, 2012 9:23 pm

TerraFrost wrote:What does $ssh->getLastError() say?

unfortunatly I don't write this module and its source code is coded.
Can you please give me an example code to connect to a sample server and generate some log files?
Thanks
astro.alireza
Traveler
 
Posts: 2
Joined: Sat Jun 23, 2012 3:05 pm

Re: Connection closed by server!!!

Postby TerraFrost » Wed Jun 27, 2012 4:14 am

Code: Select all
<?php
include('Net/SSH2.php');

$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
    exit('Login Failed');
}

echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>
TerraFrost
Legendary Guard
 
Posts: 12218
Joined: Wed Dec 04, 2002 6:37 am


Return to phpseclib support

Who is online

Users browsing this forum: No registered users and 1 guest

cron