Resolved How to install SSH2 extension for PHP7.3

Plesk instructions that you've posted the link to are pretty much step-by-step.

In regards to PHP, replace "7.0" in the instructions with "7.3" and "php70" with "php73". As for SSH2, replace "ssh2-1.1.2" with the version you need. I advise using the latest one unless there is a specific reason not to.
 
Thank you.
I tried the following:

$ sudo yum install -y plesk-php73-devel gcc libssh2-devel
....
Complete!

$ /opt/plesk/php/7.3/bin/pecl search ssh2
Retrieving data...0%
Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
ssh2 1.2 (beta) Bindings for the libssh2 library

$ sudo /opt/plesk/php/7.3/bin/pecl install ssh2-1.2
Could not download from "https://pecl.php.net/get/ssh2-1.2.tgz", cannot download "pecl/ssh2" (File https://pecl.php.net:443/get/ssh2-1.2.tgz not valid (received: HTTP/1.0 500 Internal Server Error))
Error: cannot download "pecl/ssh2"
Download failed
install failed

$ sudo /opt/plesk/php/7.3/bin/pecl install ssh2-beta
Could not download from "https://pecl.php.net/get/ssh2-1.2.tgz", cannot download "pecl/ssh2" (File https://pecl.php.net:443/get/ssh2-1.2.tgz not valid (received: HTTP/1.0 500 Internal Server Error))
Error: cannot download "pecl/ssh2"
Download failed
install failed

$

(I manually downloaded [Latest Tarball] ssh2-1.2.tgz from https://pecl.php.net/package/ssh2 )

$ sudo /opt/plesk/php/7.3/bin/pecl install ssh2-1.2.tgz

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in PEAR/PackageFile/v2/Validator.php on line 1933
PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /opt/plesk/php/7.3/share/pear/PEAR/PackageFile/v2/Validator.php on line 1933
6 source files, building
running: phpize
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
libssh2 prefix? [autodetect] : ^C

$

( I canceled for warning. )
 
I think these warnings might be safe to ignore. Proceed with the build and see if it finishes without errors...
 
  • Like
Reactions: rik
Thank you very much. it is complete. It worked correctly.
ssh2_connect() worked in php7.3 .


$ yum install -y plesk-php73-devel gcc libssh2-devel

$ yum -y install php-devel

$ wget https://pecl.php.net/get/ssh2

$ ls
ssh2

$ mv ssh2 ssh2-1.2.tgz

$ /opt/plesk/php/7.3/bin/pecl install ssh2-1.2.tgz

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

$ plesk bin php_handler --reread

$ service plesk-php73-fpm restart
 
Back
Top