12 Steps to Install libssh2 for PHP7

After successfully using libssh2 with PHP5 from the last post, I need to use libssh2  with PHP7 too. Yet, to install libssh2  to be working with PHP7 is not as easy as in PHP5. From just running sudo apt-get install libssh2-php , you need another few more steps. The overall steps I followed was from this link. However, it’s not fully working for me, so the additional steps are needed.


Ubuntu 14.04.3 LTS x86_64 – Homestead (0.4.1)

Steps to Install libssh2

  1. Install dependencies for PECL ssh2
  2. Download PECL ssh2 fior PHP7
  3. Unzip the file
  4. Enter the directory
  5. Locate phpize
  6. Take the path of phpize  and run in the directory
  7. Locate php-config
  8. Check configuration and make sure you pass the path of php-config  too
  9. Then make and install
  10. Add the extension into  php.ini
  11. Restart php7.0-fpm
  12. Finally, test it!


  1. https://medium.com/php-7-tutorial/solution-how-to-compile-php7-with-ssh2-f23de4e9c319#.rqe01zrgx
  2. http://php.net/manual/en/install.pecl.phpize.php