Make SSH connections with PHP

nasil yaptim

Make SSH connections with PHP

libssh2

Now we need libssh2 from sourcefourge. We have to compile this, but no worries, this is all you need to do:

cd /usr/src
wget http://surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.14.tar.gz
tar -zxvf libssh2-0.14.tar.gz
cd libssh2-0.14/
./configure
make all install

sonra

locate ssh2.so

sonra

onu usr/local/lib altina kopyala

sonra

php.ini de extension diri degistir /usr/local/lib olarak

sonr aoldu bitti

Installation
ssh2.so

Next we need to link libssh & PHP together. There’s a PECL module for this so let’s install using:

pecl install -f ssh2

The -f makes sure ssh2 is installed even though there’s not a stable candidate. You could also use the package name: ssh2-beta to overrule this.

Now you need to make sure our new ssh2.so module is loaded by PHP. Edit your php.ini file (for CLI utitilies: /etc/php5/cli/php.ini, for Apache utilities /etc/php5/apache2/php.ini)

extension=ssh2.so

It should be placed beneath the: “Dynamic Extensions” section somewhere around line 515.