Getting PHP with SSH support is not an easy task in Snow Leopard. If you need it, here’s a hackish way to do it, until Sara or Mike get around to patching the ssh2 in PECL.
Requirements:
- Xcode : You’re going to be compiling stuff, get it from the apple dev site, be sure to install the unix dev tools.
- Brew: This will help you install libssh2: http://github.com/mxcl/homebrew
The Hack
In an ideal world, all you should’ve had to do is just run sudo pecl install ssh2-beta, if you do this, it’ll fail even after you’ve met the dependencies above.
To make your life easier, go ahead and run that command, and let it fail. Once it fails, you’ll need to patch the downloaded file.
In my case, I had to go to /private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/download/ssh2-0.11.0
- Go get the patch file mentioned here: http://pecl.php.net/bugs/bug.php?id=16727
- Install the patch: patch -p0 < ssh2-php53.patch
- Run make
- Run make install
- Add the extension in php.ini (extension=ssh2.so)
Have fun with the docs: http://php.net/manual/en/book.ssh2.php
PS: I’m running Snow Leopard 10.6.3 so my paths may be different than most people running 10.6.2. (yes 10.6.3 will have 5.3.1)