Replace use of SSH2 PHP extension with phpseclib
DivineOmega opened this issue · 11 comments
Instead of using the SSH2 PHP extension, we should use the phpseclib native SSH implementation.
Using the phpseclib advantage is as follows:
- We don't have to install additional
ssh2extension to create the SSH connection.
@peter279k Exactly. One of the main benefits.
It's also not currently possible to get the SSH2 PHP extension installed correctly on Travis, so testing has to be done locally at the moment. This would be mitigated it the extension was not required.
@peter279k Thanks for the info. However, I believe I attempting this method. It does not seem to work on modern PHP versions (>= 7.1).
Maybe I will try that later.
That'd be good. I'd prefer to have Travis testing the package if possible.
@DivineOmega, it seems that the ssh2 extension has been already loaded in Travis CI build with php-7.1, and php-7.2 build environment.
I also have the successful tests during Travis CI build.
To enable that ssh2 extension, adding the echo "extension=ssh2.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini this line before using the php-ssh2 extension.
For php-7.3 test, we should do following steps:
- Clone the latest
php-ssh2project fromgit.php.net. - Running
phpize,makeandmake install. - It will be done for
php-ssh2compilation and adding theextension=ssh2.soin specificphp.inifile to enablessh2extension.
I also create the sample_connect.php to validate the SSH2 connection is successful for using the public key authentication during Travis CI build.
The Travis CI build results are as follows:
This is great. Thanks for investigating it further for me.
Feel free to open a PR that applies this .travis config file to the repo, if you wish.
Since we can now correctly test the SSH extension version with Travis, I'm less concerned about moving to phpseclib. Thank @peter279k.
However, I'll leave this issue open as it is still a possible improvement for the future.
@DivineOmega, thanks for your concern.
I agree with that we can leave this issue and keep this issue open.
phpseclib is now used as of version 2.0.0.