Make SSH connections with PHP

nasil yaptim

Make SSH connections with PHP


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

cd /usr/src
tar -zxvf libssh2-0.14.tar.gz
cd libssh2-0.14/
make all install




onu usr/local/lib altina kopyala


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

sonr aoldu bitti


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 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)

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