While working on the Autopilot system, I choose to use the php_ssh2 library, which uses the libssh2 library to issue/implement ssh commands. With this module loaded (http://www.php.net/ssh2), one can act as an SSH2 client in php!
Well, as many of you know, I work off of a Windows system for development ( a highly modified windows installation ;)). So, to enable, I just "enabled" the php_ssh2 lib. Easy enough right? WRONG! For this blog entry, I will discuss issues with BOTH implementations of this seemingly troublesome module.
Yes, I'm talking about windows first. The other 95% of you can go ahead and scroll down to the linux section where I talk about compiling the module from source.
After I enabled the windows module, I kept getting errors in my php log saying that the module could not be found. I didn't know what was going on? I had OpenSSL installed, the openssl module enabled, and still, I got errors? Well, it seems that there is a problem and some type of conflict with Apache under windows when running this module, thus why the errors appeared. The errors ONLY appear when you try and enabled the module in your php.ini file, OR if you try to dynamically load the module in your php code (e.g. via the dl function [http://www.php.net/dl]). BUT, the error does NOT appear, and the module loads fine IF you load it in from a CLI script.
So, to summarize:
I thus had to a slick work around, bascially calling my CLI script from my PHP code to load the lib and do my dirty work :).
Linux is a different bear. The module loads fine from the php.ini file, the problem is getting the module. Most of the repos I found only had libssh2 version .1x. The php documentation specifically says that:
"Requires libssh2 version .4 or higher"
So, I then turned to compiling the module from source. I downloaded the libssh2 module from sourceforge. I ran my commands (./configure && make install ), and figured I was off and running. I then turned to php to compile/load my php_ssh2.so module. However, when i did "pecl install ssh2-beta" (and you MUST use ssh-beta as there is currently NOT a stable version), I kept getting errors.
Well, it seems that the make file needs to be patched in order to compile correctly ( the patch is attached to this blog post ).
So, in summary:
earnest's blog
Comments
Patch?
Where's the patch you mentioned in this blog?
Post new comment