2

I have been trying for a while to get the SSH 2 extension for php installed on my CentOS 5.6 x64 server. I started the server from scratch and here are the steps I have taken

  1. install and configure APF
  2. install apache
  3. install php
  4. install mysql
  5. add epel repository
  6. install php-pear so I can use pecl
  7. run yum install libssh2-devel
  8. run pecl install ssh2-beta
  9. echo extension=ssh2.so>>/etc/php.ini (There were a few extra things in there such as installing phpMyadmin and wordpress)

After this I run php -m to see the php modules and ssh2 is not listed. I have been searching forever for tutorials and have found a few but from what I can see I have done everything correctly. Can anyone see where I am going wrong. I can provide any config files you may need. Also I have hear about phpseclib and was wondering if this would be an easier/better route? Any help would be greatly appreciated!

neubert
  • 15,947
  • 24
  • 120
  • 212
Beamer180
  • 1,501
  • 5
  • 19
  • 25

3 Answers3

4

You could maybe try phpseclib, a pure PHP SFTP implementation, instead. eg.

<?php
include('Net/SFTP.php');

$sftp = new Net_SFTP('www.domain.tld');
if (!$sftp->login('username', 'password')) {
    exit('Login Failed');
}

echo $sftp->pwd() . "\r\n";
$sftp->put('filename.ext', 'hello, world!');
print_r($sftp->nlist());
?>
neubert
  • 15,947
  • 24
  • 120
  • 212
  • I think this is going to be what I am going to use. Have you used this library before? Specifically the SSH functions? – Beamer180 Mar 28 '12 at 05:02
2

Make sure /etc/php.ini is actually used. check php --info output to see the used ini file(s)

At least on debian the path would be /etc/php5/cli/php.ini

Niko Sams
  • 4,304
  • 3
  • 25
  • 44
  • I checked and this is the used however from what I have found there is a patch that must be done for the module to work with php 5.3.* which I am using. – Beamer180 Mar 28 '12 at 05:00
  • Can you please provide me that patch. I am facing same issue – Mian Anjum Apr 26 '16 at 07:10
0

Maybe there's no difference, but if not already like this, try:

extension="ssh2.so"
parserr
  • 729
  • 1
  • 5
  • 15