|
Search:
Advanced search
|
Browse by category:
|
Contact Us |
How to install SSH2 for PHP Shell? |
|||||
Step : 1
install openssl if it's not already there in the server by the following way- #yum install openssl Step : 2 install libssh2 by the following way- #wget http://voxel.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.18.tar.gz #tar -zxvf libssh2-0.18.tar.gz #cd libssh2-0.18 #./configure #make #make install Step : 3 Now install ssh2 php module by the following way- #wget http://pecl.php.net/get/ssh2-0.10.tgz #tar -xzf ssh2-0.10.tgz #cd ssh2-0.10 #vi ssh2.c (Search for the line: #if LIBSSH2_APINO < 200412301450 and replace it with: #if LIBSSH2_VERSION_NUM < 0x001000 ) #phpize && ./configure -with-ssh2 && make #make test #make install Step : 4 Link the ssh2 library with php. copy ssh2-0.10/.libs/ssh2.so to php extension_dir mentioned at php.ini Add the following line to php.ini- extension=ssh2.so It's done. Now use a simple function to test it. <?php $connection = ssh2_connect('servername', 22); ssh2_auth_password($connection, 'username', 'password'); if(ssh2_sftp($connection)) { echo "connect"; }else { echo "not connected"; } ?> That's all :) |
|||||
Powered by
Deru Communications (Webhosting Knowledgebase)