PHP Extended SSH functionality

Source: Internet
Author: User

1. Download the two packages required to expand SSH, Libssh2 and SSH2.

Libssh2:http://pan.baidu.com/s/1hq7xohu

LIBSSH2 Official website: http://www.libssh2.org/download/

Ssh2:http://pan.baidu.com/s/1bnhdayb

SSH2 Official website: HTTP://PECL.PHP.NET/PACKAGE/SSH2

2, Installation Libssh2

1 tar -zxvf libssh2. Tar . GZ 2 CD Libssh2 3 ./configure--prefix=/usr/local/libssh24make makeinstal 

3, Installation Ssh2

1 tar -zxvf ssh2.tgz2cd SSH23phpize4 ./configure-- Prefix=/usr/local/ssh2--with-ssh2=/usr/local/libssh25 make

4. Copy the generated ssh2.so file to the extended directory specified in the php.ini

The contents of php.ini are: Extension_dir =/usr/local/php/ext/

Extension_dir is an expanded directory of PHP configuration

In the php.ini file, look for the location of the Extension_dir, assuming:/usr/local/php/ext/, then you can execute the following command

1 CP ssh2.so/usr/local/php/ext/

5, modify the content of php.ini

Add content to php.ini:extension=ssh2.so

6. Restart Apache

1 Service httpd restart

7, check whether the installation is successful, and simply use SSH extension.

1. See if you have installed

1 <? PHP 2     Phpinfo (); // if SSH2 is already installed, the page will prompt you to expand the Ssh2

2, simple use SSH2

1 <? PHP 2     $connection = ssh2_connect (' 202.112.113.250 '); 3     $flag = Ssh2_auth_password ($connection, "root", "root"); 4     Var_dump ($flag);

SSH2 's Help document: http://php.net/manual/zh/ref.ssh2.php

    

Note: When installing LIBSSH2, it went well, but when installing SSH2, I encountered various errors. This situation may be ssh2 and LIBSSH2 version incompatibility, at this time, you should go to the official website to download other versions.

PHP Extended SSH functionality

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.