Add to MAMP pro from source


A tell tale sign that ssh2 is missing is that exception is thrown on the line using this function.

ssh2_connect( ) ;



Adding SSH2 extension to your MAMP the hard(er) way

Well, if my binary above doesn’t work for you, then you may have to compile SSH2 extension yourself. Please look over my other article Rebuilding MAMP stack from scratch. to make sure you have all the prerequisites. Assuming that you do,

  1. Download libssh2 from sourceforge.
  2. Then untar the file and compile it.
    user:compile$ tar -xf libssh2-1.2.1.tar
    user:compile$ cd libssh2-1.2.1
    user:libssh2-1.2.1$ ./configure
    user:libssh2-1.2.1$ make
    user:libssh2-1.2.1$ sudo make install
  3. Download SSH2 PECL source code.
  4. Then untar and compile it.
    user:compile$ tar -xf ssh2-0.11.0.tar
    user:compile$ cd ssh2-0.11.0
    user:ssh2-0.11.0$ phpize
    user:ssh2-0.11.0$ ./configure
    user:ssh2-0.11.0$ make
  5. Once you successfully compile, you should have under modules/ directory. At this point, you can simply copy the file to the appropriate location of your PHP (or you can follow the same instructions above for either MAMP or the built-in PHP).

That’s about it … I hope that this article helps you in enabling ssh2 extension for PHP on your MacOS X. And as always, I welcome comments / suggestions / questions. I’m looking forward to improving my solution with your comments / suggestions / questions.

Leave a Reply