• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question How to install SSH2

proxene

New Pleskian
Hello ,
I have a little problem, I'm busy spending all my websites under php7 the problem is that in php5 I install ssh2. So my question is how to install ssh2 on Debian 8 with Plesk 12.

Thank you in advance.

Regards ,
Proxene
 
Hi proxene,

did you already try this command?

apt-get install libssh2-1 libssh2-1-dev libssh2-php libnet-ssh2-perl python-libssh2
 
Hi UFHH01,
Unfortunately I still have the same problem :/

Fatal error: Uncaught Error: Call to undefined function ssh2_connect()
 
Hi proxene,

for further investigations, people willing to help you need more informations.

Which Plesk version do you use ( incl. the MU pls. )?
Which PHP version do you use as vendor package?
Which PHP version do you use for the domain with possible issues/errors/problems?

Did you consider to install the SSH2 - pecl package ( if "yes" - how did you install it? ) and did you enable this extension for your PHP version with issues/errors/problems?
 
Hi UFHH01,

The following information in relation to my problem:
Here is my error: Fatal error: Uncaught Error: Call to undefined function ssh2_connect ()
I use Plesk PHP7 under 12 under Debian 8
I already install SSH2 on the server when I was under PHP5.6

The problem is that I do not know install SSH2 under PHP7 with Plesk and as I did not find the article about it and I've already made my server crash trying I do not want to mishandling.
 
Hi proxene,

just for your knowledge:

If you install for example SSH2 with pecl, then you could have used "pecl install ssh2". This process doesn't install the package for additional PHP versions - it installs it for your basic vendor version on your server.
If you desire additional extensions for Plesk-PHP - versions, you have to install them for example with the command(s):

/opt/plesk/php/X.X/bin/pecl install ssh2

... where X.X is the Plesk-PHP version, you want the desired extension to be installed for. Pls. note, that NOT ALL PECL - extensions are compatible with all PHP - versions. Especially with PHP 7, there are now either new extensions, or even none, which can be installed. When you use the command "pecl install PACKAGE-NAME", always the latest stable version will be used, which doesn't automatically mean, that this version is compatible with your desired PHP version. A possible example for this is:

/opt/plesk/php/7.0/bin/pecl install memcached

You will see the message:

pecl/memcached requires PHP (version >= 5.2.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.0.9
No valid packages found
install failed

In such case, you have to look at the PECL - homepage and search for the package ( => https://pecl.php.net/package-search.php ). If you did that, you will be informed with this actual informations:
Dependencies
Release 2.2.0:
PHP Version: PHP version 6.0.0 or older
PHP Version: PHP 5.2.0 or newer
PEAR Package: PEAR 1.4.0b1 or newer
Release 2.2.0RC1: PHP Version: PHP version 6.0.0 or older
PHP Version: PHP 5.2.0 or newer
PEAR Package: PEAR 1.4.0b1 or newer
Release 2.2.0b1: PHP Version: PHP version 6.0.0 or older
PHP Version: PHP 5.2.0 or newer
PEAR Package: PEAR 1.4.0b1 or newer
You see, there is no available "memcached" version for PHP 7 which you could install with PECL.​



Now back to your issue, that you only installed SSH2 for your basic, vendor PHP version:

Pls. consider to use for an actual Plesk-PHP version 7.0.9 the command:

/opt/plesk/php/7.0/bin/pecl install ssh2

You will see, that this doesn't work and a research at the PECL - homepage will show you why:
ssh2 1.0 and above is PHP 7 only. To install a version that is PHP 5 compatible you can run 'pecl install ssh2-0.13'

1. You will have to use the command:

/opt/plesk/php/7.0/bin/pecl install ssh2-1.0

2. Afterwards, to enable the new ssh2 extension, you have to add it to your "php.d" - folder, so that it will load, when you use Plesk-PHP 7:

echo "extension=ssh2.so" > /opt/plesk/php/7.0/etc/php.d/ssh2.ini

3. And finally, you want the Plesk php-handler to know, that you installed a PHP extension, so pls. perform the command:

plesk bin php_handler --reread

( Now you are able to see the new extension as well over the Plesk Control Panel: Home > Tools & Settings > PHP-Settings > 7.0.9 XXX application )


If you experience any issues/errors when installing a PECL extension(s), pls. inform about your procedure to install your extension, so that people willing to help you don't have to write such a whole book, like I did here. :D:p:D



 
Last edited by a moderator:
Back
Top