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,
- Download libssh2 from sourceforge.
- 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 Password:
- Download SSH2 PECL source code.
- 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
- Once you successfully compile, you should have ssh2.so 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.