First, two packages are required to install the SSH2 extension for PHP.Libssh2 and Ssh2 (php pecl extension). The latest versions of the two are libssh2-1.5.0.tar.gz and ssh2-0.12.tgz, respectively, http://www.libssh2.org/download/and HTTP://PECL.PHP.NET/PACKAGE/SSH2. Next, unzip and installLibssh2 and Ssh2. Among them, Libssh2 need to install first, SSH2 after installation. The installation steps are as follows:
# TAR-ZXVF libssh2-1.4. 2 . tar.gz# CD LIBSSH2-1.4. 2 # . /configure--prefix=/usr/local/&& make install
The above is to install the LIBSSH2, here need to remember LIBSSH2 installation directory, because in the installation of SSH2 will be used.
# Locate Phpize
#/usr/local/php/bin/phpize
# TAR-ZXVF Ssh2-0.12 Span style= "color: #000000;" >.tgz# CD ssh2 -0.12 #/usr/local/php/bin /phpize
Configuring for:
PHP Api version: 20131106
Zend Module API no: 20131226
Zend Extension API no: 220131226
# Locate Php-config
/usr/local/php/bin/php-config# ./configure--prefix=/usr/ Local/ssh2--with-ssh2=/usr/local/libssh2--with-php-config=/usr/local/php/bin/php-config# make
# make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226 /
/usr/local/php/lib/php/extensions/no-debug-zts-20131226# ls
memcache.so mongo.so opcache.so redis.so ssh2.so xcache.so
Edit php.ini File Information
" /usr/local/php/lib/php/extensions/no-debug-zts-20131226/ " extension=mongo.soextension=redis.soextension=memcache.soextension= Xcache.soextension=ssh2.so //Add new information
Restart Apache
PHP Open SSH2