I was building out the ssh2 extension (0.10) under OpenBSD 3.9 on sparc64 and I got this error when running configure:

checking for libssh2_banner_set in -lssh2... noconfigure: error: libssh2 version >= 0.4 not found

I did some poking around in the configure file and traced the problem down. The reason for the failure is that configure is trying to compile a test program with -ldl. libdl is not installed on OpenBSD 3.9. The OpenBSD folks purged libdl years ago and I could not find a package that contains it.

(The error message above is misleading because the problem is not with libssh2.)

I looked at the ssh2 extension code and could not see a reason for using libdl, so I removed the -ldl from the config.m4 file. Re-ran phpize and configure. No errors. Did make and installed ssh2.so. Works fine.

11) Check your shell's path variable by SHELL$ "echo $PATH". If your php5 binary directory is not listed before the standard OS X binary directory, update your $PATH variable to list it first. Mine reads: /usr/local/mysql/bin/: /usr/local/php5/bin/: /bin:/sbin: /usr/bin:/usr/sbin 11a) if you do not do this step, the PECL extension will link against the old php4 version that ships with Mac OS X. You will know this by the fact that the next step lists a server API that is different than the output of phpinfo(): My version was 20041030, Apples version was 20020429.12) Run: phpize && ./configure --with-ssh2 && makeThis will produce a lot of output and probably some warnings. If you get a note at the end that says "Build Complete", then the process has completed (probably successfully). The command has produced the output file ssh2.so within the ssh2-0.9 (or whatever version) directory.13) Check where the extension directory is located at by running the following command:SHELL$/usr/local/php5/bin/php-config --extension-dirIf it lists some directory that actually exists, copy the ssh2.so file to this directory.If it doesn't list a location that exists, you can either create the location, or choose a different location and update the line in your php.ini file:extension_dir = "./"to point to the directory you would like to use. I chose:extension_dir = "/usr/local/php5/extensions/"?>14) Add the lineextension=ssh2.soto the Dynamic Extensions area of your php.ini file.15) Restart your web server for the extensioin to be loaded. If there are any problems, they will be written to the webserver log.16) Check if your new ssh based streams are available by running:SHELL$ /usr/local/php5/bin/php -r "print_r(stream_get_wrappers());"You should get something similar to this output:Array( [0] => php [1] => file [2] => http [3] => ftp [4] => compress.bzip2 [5] => compress.zlib [6] => https [7] => ftps [8] => ssh2.shell [9] => ssh2.exec [10] => ssh2.tunnel [11] => ssh2.scp [12] => ssh2.sftp)You should now be able to do all the cool things you need to do with ssh (like sftp scp ssh execution)! Take a look at some of the comment here for some example scripts to test things out:http://us2.php.net/manual/en/ref.ssh2.php

Trying to compile this ssh PECL extension for Mac OS X (10.4.2) with entropy.ch's php5 distribution? Read on: PART 1:1) Download libssh (I used version 0.11)http://sourceforge.net/project/showfiles.php?group_id=1258522) Unzip the directory and cd to the upacked directory in the terminal.3) run: ./configure; make all install;libssh should compile and place the output file in src/*.o4) copy all headers from the include folder within the libssh2 directory to/usr/local/include/5) copy all compiled files (*.o) from the src folder within the libssh2 directory to /usr/local/lib/6) Download ssh2 (I used version 0.9 with additional changes from cvs - explained below)http://pecl.php.net/package/ssh27) unzip the downloaded archive.8) version 0.9 has a conflict with an existing symbol used in some of the ZEND headers... a change is available in cvs which renames the symbol in ssh2 to avoid the conflicthttp://cvs.php.net/diff.php/pecl/ssh2/ssh2.c?r1=1.9&r2=1.10&ty=hdown load at least the 1.10 version of ssh2.cif you decide to download a newer version, download any of the corresponding related files, such as the php_ssh2.h header file.9) replace the old version of ssh2.c with the new version of ssh2.c (and any other files you downloaded).10) From the terminal: cd to the source directory (for me ssh2-0.9/ssh2-0.9/).

Some installations of PHP 5 may have a problem starting the SSH2 extension as a Windows' service. It just started happening to me today, spontaneously. I have PHP 5.2.2 (and have tried 5.2.3), on Apache 2.0.59 .

It turns out that it's an Apache problem. Even though I was given an error message when starting it, it still worked perfectly from the CLI. So, I commented it out in theINI file again, and am just loading it using extension_loaded('ssh2') and dl('php_ssh2.dll') from within the script.