WordPress – OpenCart – SEO – Web Development

How to install ssh2 extension for PHP

Question

How to install ssh extension for PHP?

Answer

For CentOS only For OS php package: #cd  usr/local/lib/php
  1. Install all missing packages:
    # yum install make gcc glibc-devel zlib-devel openssl-devel php-devel
    
  2. Compile and install libssh2 libraries:
    # wget https://libssh2.org/download/libssh2-1.8.0.tar.gz
    # tar vxzf libssh2-1.8.0.tar.gz
    # cd libssh2-1.8.0/
    # ./configure
    # make
    # make install
    
  3. Compile and install ssh2 extension:
    # wget https://pecl.php.net/get/ssh2-0.13.tgz
    # tar vxzf ssh2-0.13.tgz
    # cd ssh2-0.13
    # phpize
    # ./configure --with-ssh2
    # make
    # make install
    
  4. Add extension to PHP:
    # echo "extension=ssh2.so" > /etc/php.d/ssh2.ini
    
  5. Check that it is working:
    # php -m | grep ssh2
    ssh2
    
For Plesk php(5.6 as example):
  1. Install all missing packages:
    # yum install make gcc glibc-devel zlib-devel openssl-devel plesk-php56-devel
    
  2. Compile and install libssh2 libraries(not required if it was previously done):
    # wget https://libssh2.org/download/libssh2-1.8.0.tar.gz
    # tar vxzf libssh2-1.8.0.tar.gz
    # cd libssh2-1.8.0/
    # ./configure
    # make
    # make install
    
  3. Install ssh2 extension:
    # /opt/plesk/php/5.6/bin/pecl install https://pecl.php.net/get/ssh2-0.13.tgz
    
    on 'libssh2 prefix? [autodetect] :' leave empty and press enter
  4. Add extension to PHP:
    # echo "extension=ssh2.so" > /opt/plesk/php/5.6/etc/php.d/ssh2.ini
    
    1. Check that it is working:

      /opt/plesk/php/5.6/bin/php -m| grep ssh2

      ssh2
Note : For Plesk PHP 7.0 it is required to download ssh2-1.0.tgz   <?php phpinfo(); ?>

ssh2

SSH2 support enabled
extension version 0.13
libssh2 version 1.8.0
banner SSH-2.0-libssh2_1.8.0
  you can use the phpseclib library to connect with SFTP. Examples on how to use the phpseclib can also be found on the phpseclib page. http://phpseclib.sourceforge.net/ http://phpseclib.sourceforge.net/sftp/intro.html http://phpseclib.sourceforge.net/ssh/intro.html http://phpseclib.sourceforge.net/ssh/auth.html#rsakey

Từ khóa: ,

Giới thiệu tác giả

Giới thiệu tác giả: .

Gửi bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Top