Project

General

Profile

Actions

Install SSH module for PHP shared » History » Revision 4

« Previous | Revision 4/8 (diff) | Next »
Neil Voss, 08/14/2012 01:37 PM


Install SSH module for PHP

This installation occurs on the web server.

The ssh2 extension for php

First, install the following prerequisites:

Name: Download site: CentOS yum package name Fedora yum package name SuSE rpm name
php devel http://www.php.net php-devel php-devel
libssh2 devel http://www.libssh2.org libssh2-devel (found in epel repo) libssh2-devel
SSH PECL extension http://www.php.net/manual/en/ssh2.installation.php - php-pecl-ssh2

For newer systems the extension is available through the repository, e.g., on Fedora 12 type "sudo yum install php-pecl-ssh2"

CentOS 6: Install the ssh2 extension

sudo yum install php-pecl-ssh2

CentOS 5: Download and compile the ssh2 extension

This setup is almost identical to the Install the MRC PHP Extension. See http://www.php.net/manual/en/ssh2.installation.php for more information.

  1. Go the website http://pecl.php.net/package/ssh2
  2. Download the latest version of ssh2:
    wget http://pecl.php.net/get/ssh2-0.11.3.tgz
  3. Extract the tar ball
    tar zxvf ssh2-0.11.3.tgz
  4. Go into the directory
    cd ssh2-0.11.3
  5. Run phpize and standard make process
    phpize
    ./configure
    make
  6. Install the module:
    sudo make install
  7. Add a ssh2.ini to your php ini folder:
    sudo touch /etc/php.d/ssh2.ini
    sudo chmod 666 /etc/php.d/ssh2.ini
    echo "; Enable ssh2 extension module" > /etc/php.d/ssh2.ini
    echo "extension=ssh2.so" >> /etc/php.d/ssh2.ini
    sudo chmod 444 /etc/php.d/ssh2.ini
    cat /etc/php.d/ssh2.ini
    
  8. Restart httpd:
    sudo /sbin/service httpd restart

Test if the module is working:

  1. go to the info.php that was created earlier in the Install the MRC PHP Extension, http://localhost/info.php or http://HOST.INSTITUTE.EDU/info.php
  2. search for the ssh2 module, you should see this section:

Still having problems?

  1. on one machine restarting httpd was not enough, I had to restart the entire system to get it working (even though it shows up under info.php)

Updated by Neil Voss over 12 years ago · 4 revisions