To use SSH in PHP, it seems that most of the materials on the Internet are copied in a version. I finally think there are two blogs that are well described, both of which are in English, one of them is the original English version, which is widely used, but it is difficult to install it, and then it was re-installed again. I don't know if it is because the occasional system is centos. Sort by yourself first:
1. Install OpenSSL
A. # Yum install OpenSSL
B. # Yum install OpenSSL-devel
2. Install libssh2:
A. # cd/usr/src
B. # wget http://www.libssh2.org/download/libssh2-1.2.8.tar.gz
C. # tar-zxvf libssh2-1.1.tar.gz
D. # cd libssh2-1.1
E. #./configure
F. # Make all install
3. Link libssh & PHP together, using PECL:
A. # PECL install-F SSH2
B. Make sure that the generated ssh2.so is in the extension directory specified by PHP. ini.
C. Modify PHP. ini and add extension = ssh2.so.
4. Compiling libssh2 PHP extension (instead of step 1 above, it seems that the above version is unstable)
A. # wget http://pecl.php.net/get/ssh2-0.11.0.tgz
B. # tar-zxvf ssh2-0.11.0.tgz
C. # cd ssh2-0.11.0
D. # phpize &./configure-with-ssh2 & make
E. # cp./modules/ssh2.so/usr/lib/php/modules/ssh2.so
F. Modify php. ini and add extension = ssh2.so.
5. restart httpd: service httpd restart