Prerequisite:
PEAR should be already installed in the system before configuring the phpseclib channel.
Steps:
PHPSecLib is a library of optional PHP extensions which comes in handy if the application were to be packaged as a solution for deployment to the end user.
1. Register the channel
c:\> pear channel-discover phpseclib.sourceforge.net
2.List the packages available
c:\> pear remote-list -c phpseclib
AVAILABLE PACKAGES:
PACKAGE VERSION
Crypt_AES 0.3.1
Crypt_DES 0.3.1
Crypt_Hash 0.3.1
Crypt_RC4 0.3.1
Crypt_RSA 0.3.1
Crypt_Random 0.3.1
Crypt_Rijndael 0.3.1
Crypt_TripleDES 0.3.1
File_ANSI 0.3.1
File_ASN1 0.3.1
File_X509 0.3.1
Math_BigInteger 0.3.1
Net_SFTP 0.3.1
Net_SSH1 0.3.1
Net_SSH2 0.3.1
3. Install the needed packages. For e.g. if you want Net_SFTP package
c:\> pear install phpseclib/Net_SFTP
If you have lower than Php version 5.3.0, you may encounter issues installing phpseclib on it. For an easy install try a different version of php when you experiment with phseclib.
Sample Program:
<?php set_include_path(get_include_path() . PATH_SEPARATOR . ‘/phpseclib’); include(‘Net/SSH2.php’); include(‘Net/SFTP.php’); echo get_include_path(); $sftp = new Net_SFTP(‘greenland:22′); if (!$sftp->login(‘root’, ‘evylouss’)) { exit(‘Login Failed’); } ?>