Install SSH2 Extension Through PECL (Ubuntu 12+)

I am working on an application that interfaces with remote servers through SSH so of course I need the ssh2 extension installed. I am currently running 5.5 from a previous tutorial, but this should work in the 'traditional' php installed through sudo apt-get install php5-cli.

    sudo apt-get install libssh2-1 libssh2-1-dev
    sudo pecl install ssh2 channel://
    If you read the last bit of text from the previous step, you will notice that the last instruction states: "You should add "" to php.ini", so now you should add that to your php ini files.
    sudo vim /etc/php5/cli/php.ini
    Find the header "Dynamic Extensions" and place directly below as shown here.

    [Don't worry if you don't have that "" bit, that's just another extension I have.]
    Now do the same for apache (if you want it there that is)
    sudo vim /etc/php5/apache2/php.ini
    Repeat the previous step (add the .so line), before saving and running the following command.
    sudo service apache2 restart


1 comment:

  1. It can be done more easly with:

    sudo apt-get update
    sudo apt-get install -y libssh2-php
    sudo service apache2 reload