2

I run sudo apt-get install libssh2-1-dev libssh2-php I get:

Reading package lists... Done
Building dependency tree
Reading state information... Done
libssh2-php is already the newest version.
libssh2-1-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 71 not upgraded.

But it does not work. I don't see them installed when run php -m |grep ssh2 #you should see ssh2

What steps would you take next? One thing to note that when I ran sudo apt-get update I noticed that it's connecting to http://archive.ubuntu.com trusty/multiverse . Could that be an issue?

Rayhan Muktader
  • 121
  • 1
  • 2

2 Answers2

1

To install ssh2 extension for PHP5 , run:

sudo apt-get install gcc make autoconf libc-dev pkg-config php5-dev
sudo pecl install ssh2-0.13

Or

sudo pecl install https://pecl.php.net/get/ssh2-0.13.tgz

Restart the php-fpm service then verify it:

php -i | grep ssh2

pecl : ssh2

GAD3R
  • 63,407
  • 31
  • 131
  • 192
  • I followed the instruction and the modules are available when I run php through apache. But not when I run php from command line. Any suggestions? – Rayhan Muktader Nov 06 '17 at 16:24
  • Usually there are 2 configuration files for PHP (php.ini) one for Apache and one for console (CLI). This means that Apache's configuration loads the extension while the console one don't. Check /etc/php folder for them. – Alex Sep 19 '18 at 07:53
1

PHP-5.X + PHP-7.X Installation Instructions cover the difference.

It appear you must use a pecl install procedure when using PHP-5.X versions.

David Favor
  • 423
  • 3
  • 5