Bob and the Knowledge Factory / Linux / Secure SHell / How to Install SSH2 for PHP shell connections
How to Install SSH2 for PHP shell connections |
|||||
We need a few modules installed on the server if we want to open SSH connections from within a PHP script. The main 3 packages needed for the installation are: a ) OpenSSL and of course we need root access to the server. OpenSSL will be installed in many of the servers. To confirm if openssl is installed or not, please execute the following command in shell.
openssl096b-0.9.6b-22.46 The versions may vary depending on the OS in the server. If you did not get any output, you need to install OpenSSL. We can easily install openssl using yum or apt-get(redhat or debian based servers):
The second package which is needed in the server is libssh2. The installation steps are given below:
ext we need to install ssh2 php module. The installation steps are given below:
Now you need to copy ssh2.so module to the php extensions directory which you can find out where it is by checking the php.ini file. To find the location of the ssh2.so module. You can do it by the command:
If in php.ini you got the php extensions directory as "/usr/local/lib/php/extensions/no-debug-non-zts-20060613", then do the following steps.
If after running phpize && ./configure --with-ssh2 && make you end up with an error like make: *** [ssh2.lo] Error 1 you will have to do a small hack.
Save the file and run phpize && ./configure --with-ssh2 && make again. If everything finishes fine you are done.
|
|||||